Wednesday, April 6, 2011

JS File Not Being Executed

<script type="test/javascript" src="/js/something.js"></script>

Nothing looks out of place there, right? Then what's going on that, in Firefox, Chrome, Steel, Android Browser, and IE 6, the page loads and does not execute anything in schedulegrid.js? Even if it is just a single alert() call: nothing. Firebug shows the correct contents of the script, so I know its loading it. What could cause a js script to be included by all the browsers, but executed by none of them, yet have nothing to do with the actual contents?

From stackoverflow
  • it should be "text/javascript" not "test/javascript"

    ironfroggy : WTF is wrong with me? Thats the kind of thing you brain screws with you on. Thanks. Once you think you know what something says, you don't re-read it.
    some : Been there, done that, got the t-shirt...
    Greg : I've done it too
  • I could easily see this being a misplaced or unclosed open-brace. Maybe if you create a new function at the top of the file like the following and test it:

    function onload() {
        alert("testing");
    }
    

0 comments:

Post a Comment