[thelist] javascript / document.write / include javascript

Bob Meetin bobm at dottedi.biz
Thu Aug 9 08:23:19 CDT 2012


Is there a way to include a javascript document, i.e. javascript.js, within a page if you are using javascript to define some matching criteria?

<script type="text/javascript">
   if( matches_some_mobile_criteria )
   {
      document.write("<script type='text/javascript; src='javascript.js'></script>");
   }
</script>

If I do it as above it outputs document.write, script type=, etc, rather than including the .js file.

  Bob


More information about the thelist mailing list