[SalesForce] reference a Static Resource in an HTML Area

I'd like to reference a Javascript file (Static Resource) in an HTML area within Salesforce – is this possible? Or can I only reference Static Resources from a VisualForce page?

If it is possible, would I be correct in using this code to do so: <apex:includeScript value="{!$Resource.MyJavascriptFile}"/>

Thanks in advance!

Best Answer

it is possible.

<apex:includeScript value="{!$Resource.MyJavascriptFile}"/>

translates to

<script type='text/javascript' src='/resource/1233160164000/MyJavascriptFile'>

or more generally speaking the path will be translated to

/resource/<timestamp>/<name>

which means that you can reference your static resource without the formulas

For more details see the

Component reference: http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_includeScript.htm
and the Developer Wiki: http://wiki.developerforce.com/page/Delivering_Static_Resources_with_Visualforce

Related Topic