Skip to content

Instantly share code, notes, and snippets.

@JiLiZART
Created May 8, 2013 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JiLiZART/5539726 to your computer and use it in GitHub Desktop.
Save JiLiZART/5539726 to your computer and use it in GitHub Desktop.
Extracty query from included js script
<script src="js/somefile.js?option=1,option2,option3"></script>
query = document.getElementsByTagName("script");
query = query[query.length - 1].src;
if (- 1 == query.indexOf("?")) query += "?";
query = query.substr(query.indexOf("?") + 1);
console.log(query);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment