Skip to content

Instantly share code, notes, and snippets.

@nanodeath
Created October 6, 2010 14:57
Show Gist options
  • Save nanodeath/613478 to your computer and use it in GitHub Desktop.
Save nanodeath/613478 to your computer and use it in GitHub Desktop.
<script>
if(document.location.href.match(/debug/)){
document.write("<script src=\"external.js\"><\/script>");
}
</script>
This doesn't work -- the document is loaded asynchronously in Firefox.
<script type="text/javascript">
// here's our runtime variable -- checking for "debug" in querystring
if(!document.location.href.match(/debug/)){
document.write("<!--");
}
console.log("before script tag")
</script>
<script type="text/javascript" src="/external.js"></script>
<script>
console.log("after script tag");
</script>
<script>
/* --> <script> /**/
</script>
<!--
<script src="/external.js"></script>
<!-- -->
Even this doesn't quite work -- it works on Chrome, but Firefox prints out "<!--".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment