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?
2 Answers
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 pageJitesh Goel– Jitesh Goel2016-05-03 12:43:25 +00:00Commented May 3, 2016 at 12:43
-
Yes, if you include it like this you will be able to refer it from your page.feddus– feddus2016-05-03 13:53:56 +00:00Commented May 3, 2016 at 13:53
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.