Simple Way to Extract GET Params from a JavaScript Script Tag
21–26 of 26 posts
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#22http://www.onlineaspect.com/2009/06/10/reading-get-variables...
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#23This solution fails when you need to insert the script more than once in a page. Instead, browsers really should provide scripts a means to retrieve the script element that they belong to.
A comment on the article pointed out that since javascript execution is blocking, you can do that for synchronous javascript: scripts=document.elements.getElementByTagName('script') latest=scripts[scripts.length-1]
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#24Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#25Here's a simpler way. Put this in your htaccess file: AddHandler server-parsed .js then add: (function(query_string){ ... })(" "); around your script. This obviously has problems with caching, but it doesn't have the problems addressed with those "heavy loads" that you have with PHP et al.
Holy XSS injection, Batman!
Re: Simple Way to Extract GET Params from a JavaScript Script Tag
#26Here's a simpler way. Put this in your htaccess file: AddHandler server-parsed .js then add: (function(query_string){ ... })(" "); around your script. This obviously has problems with caching, but it doesn't have the problems addressed with those "heavy loads" that you have with PHP et al.
The beauty of doing this statically entirely in javascript is that you can serve the js file from anywhere, including s3 for example.