I need to include an external JS-file with
<script src="/IframeHelper.js" type="text/javascript"></script>
But I need to set a variable and I tried somthing like this:
<script src="/IframeHelper.js" type="text/javascript">var $Vari = 'Para';</script>
And inside the "IFrameHelper.js" something like this:
var $Site = 'Rootfolder' + $Vari;
But you know...this doesn ́t work. But how can I do this? It ́s a little bit like calling a script with parameters. But such a parameter can be a JSON-String oder "long text".
1 Answer 1
As per my understanding you need to include IframeHelper.js file after you declare your variable.
<script type="text/javascript">var $Vari = 'Para';</script>
<script src="/IframeHelper.js" type="text/javascript"></script>
answered Dec 6, 2013 at 10:52
Satpal
134k13 gold badges168 silver badges171 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
HRK
yes agree, need to load variable before loading the script, so comes in scope
user1957700
Thanks...this works! The other thing I´ve tried now is to call a function in a seperate script-tag after including the file.
lang-js