Static Resources v/s Documents:
- Static resources are data cached and you can refer them easily in VF (including zip files) which store on Sales force server.
- Static Resources and Documents are having an absolute limit of 5MB for each document.
- You can package a collection of related files into a directory hierarchy and upload that hierarchy as a .zip or .jar archive), images, style sheets, JavaScript, and other files.
- You can reference a static resource by name in page markup by using the $Resource global variable instead of hard-coding document IDs.
- JavaScript or CSS is preferable to including the markup inline. Managing this kind of content using static resources allows you to have a consistent look and feel for all your pages and shared set of JavaScript functionality.
Referencing a Static Resource in Visualforce Page:
<apex:image url="{!$Resource.TestImage}" width="50" height="50" />
or
<apex:includeScript value="{!$Resource.MyJavascriptFile}"/>
No comments:
Post a Comment