Brian Barnes
Brian Barnes

Reputation: 1027

Browser not reading next js file

I have a JavaScript file where no matter where I place it in the includes, the file below it is not being run (in both Chrome and Firefox - probably other browsers as well - just haven't tested them). js files further down are still being run.

The lowest that I have been able to boil it down is:

 var robots = {
 init: function(height, width) {
     }
 };

And it also happens when I include an empty file. I have also had lines of code inside it as well.

There is a large number of javaScript files included in this page (18 (plus some inline) at this stage and more will come - aggregation and minification are on the list of todo's (but won't be happening in dev for obvious reasons)).

Any further ideas? I've inserted an empty javascript block in the html in the meantime and it works (but is a minor wtf).

Upvotes: 0

Views: 556

Answers (2)

Brian Barnes
Brian Barnes

Reputation: 1027

Man I feel like an idiot.

I had included the javascript with the following syntax error (spot the missing >):

<script type="text/javascript" src="js/robots.js"</script>

when it should have been:

<script type="text/javascript" src="js/robots.js"></script>

Upvotes: 1

Jacob
Jacob

Reputation: 78890

If you've truly determined that the JavaScript src is correct and that the content hasn't been loaded, check if your browser has any sort of ad blocker installed. I've seen the issue before where if a URL contains something like "ad" or "robot," that could be enough to trigger it being blocked.

Upvotes: 0

Related Questions