Static resources have an in-built caching feature and use the content distribution network built into Salesforce. The following are the advantages of using static resources to refer to CSS files, images, and JavaScript:
Use a static resource to display the content of another static resource with the action attribute of the
<apex:page>
tag. By doing this we can redirect from a Visualforce page to a static resource. Suppose we have a PDF as a static resource (named ashelpPdf
) and we use that static resource in the action attribute of the<apex:page>
tag as follows:<apex:page sidebar="false" showHeader="false" standardStylesheets="false" action="{!URLFOR($Resource.helpPdf)}"> </apex:page>
The
URLFOR
function plays a major role here. The redirection will not work properly without theURLFOR
function. This is not limited to PDF; we can use any static resource to redirect.<apex:page sidebar="false" showHeader="false" standardStylesheets="false" action...