You need to sign in to do that
Don't have an account?
Arun_Pali
Best practise for using shared functions ..
Folks,
I am looking out for a way to share a bunch of common java script functions between 2 visual force pages. Is there a way to achieve this.
Page1.page
<apex:page>
<script type="text/javascript">
function a() {
}
function b() {
}
</script>
// some more stuff specific to Page 1
</apex:page>
Page2.page
<apex:page>
<script type="text/javascript">
function a() {
}
function b() {
}
</script>
// some more stuff specific to Page 2
</apex:page>
Basically, I wanted to put these JS functions in a single JS file and then access it from both the pages. Is there a way to do this? If so, how & where can we store this JS file ? Pls advise.
Thanks.
I am looking out for a way to share a bunch of common java script functions between 2 visual force pages. Is there a way to achieve this.
Page1.page
<apex:page>
<script type="text/javascript">
function a() {
}
function b() {
}
</script>
// some more stuff specific to Page 1
</apex:page>
Page2.page
<apex:page>
<script type="text/javascript">
function a() {
}
function b() {
}
</script>
// some more stuff specific to Page 2
</apex:page>
Basically, I wanted to put these JS functions in a single JS file and then access it from both the pages. Is there a way to do this? If so, how & where can we store this JS file ? Pls advise.
Thanks.
Heres how you use it in vf page:-
<script type="text/javascript" src="{!URLFOR($Resource.scripts,'scripts/common.js')}"></script>