Passing Querystring style parameters into Javascript file

Posted by Mike Mengell on Stack Overflow See other posts from Stack Overflow or by Mike Mengell
Published on 2010-06-11T09:40:58Z Indexed on 2010/06/11 10:22 UTC
Read the original article Hit count: 336

Filed under:

Hi,

Not sure if this is possible or even if I should do it, but I think it's quite interesting.

I have a javascript file which I'm referencing in a flat HTML page. I'd like to pass in a parameter or two via the path to the script. Like this;

<script src="/scripts/myJavascriptFile.js?config1=true" type="text/javascript"></script>

Not really sure if it can work but it would make my solution a little easier for others to take my script and implement (arguable).

Cheers, Mike

© Stack Overflow or respective owner

Related posts about JavaScript