Newer Version Available
Best Practices for Static Resources
- Displaying the Content of a Static Resource with the action Attribute on <apex:page>
-
You can use the action attribute on a <apex:page> component to redirect from a Visualforce page to a static resource. This functionality allows you to add rich, custom help to your Visualforce pages. For example, to redirect a user to a PDF:
- Upload the PDF as a static resource named customhelp.
- Create the following page:
1swfobject.registerObject("clippy.codeblock-0", "9"); 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17<apex:page sidebar="false" showHeader="false" standardStylesheets="false" 18 action="{!URLFOR($Resource.customhelp)}"> 19</apex:page>
-
This redirect is
not limited to PDF files. You can also redirect a page to the content
of any static resource. For example, you can create a static resource
that includes an entire help system composed of many HTML files mixed
with JavaScript, images, and other multimedia files. As long as there
is a single entry point, the redirect works. For example:
- Create a zip file that includes your help content.
- Upload the zip file as a static resource named customhelpsystem.
- Create the following page:
1swfobject.registerObject("clippy.codeblock-1", "9"); 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17<apex:page sidebar="false" showHeader="false" standardStylesheets="false" 18 action="{!URLFOR($Resource.customhelpsystem, 'index.htm')}"> 19</apex:page>