function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

action Attribute on <apex: page> tag

I am doing simple test on action with in the <apex: page>

I have a word file uploaded under the Static Resource named customerhelp




<apex:page action="{!URLFOR($Resource.customerhelp)}">
Hello world!
<apex:form >
<apex:commandButton title="Sample Button" value="Sample Button"/>


1. When I load this page a popop window is displayed to dowonload/open the file within the Static Resource.
2. After that action is done by clicking OK/Cancel page remains blank.

If I try to do refresh/backward it just repeats the steps 1 & 2 . Not only it doesn't show the sample button and the 'Hello  world' text, but also does not allow to navigate to the other pages...



How can I download/open or Cancel at first (only one time ) and then see the rest of the content on the page?


Thanks in advance.



As documented, the action attribute is meant for redirection (or conditional redirection) on load of the page.


You should just use javascript to open a pop up with your page.  Put it in between <script> tags right at the top of the page and it will run when the page is loaded.

And, try to use showModalPopup() to open a window with the static resource. It suspends the execution of JavaScript on the main page untill the popup window is closed. Once the JavaScript is resumed, remaining page on the main page will be rendered.
Pragna BharadvaPragna Bharadva
There is an updated content for this, please check out: