4

I have a zipped static resource uploaded in my salesforce org which contains different types of js . I want them to be referred in my script on visualforce page. How can I do this?

6

You have to include it as you would with any other JS file.

<apex:includeScript value="{!URLFOR($Resource.LibraryJS, '/base/subdir/file.js')}"/>

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_resources_reference.htm

  • Thanks Sander for the reply , but this script is to be reffred somewhere in the my script which I have written on my page – Jitesh Goel May 3 '16 at 12:43
  • Yes, if you include it like this you will be able to refer it from your page. – feddus May 3 '16 at 13:53
0

If you want to use a static resource in the javascript then use :-

"nope: ['{!$Resource.abc}', '{!$Resource.xyz}']"

where "nope:" is a statement in my javscript.

Or else you can use just "'{!$Resource.abc}'" where ever you want to include your static resource javscript.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.