FireBug: syntax error

I’ve moved my blog to a new WordPress theme over the weekend. Everything seems to work fine except that I get the following error message in FireBug:

syntax error doctype html

Obviously <!DOCTYPE html> is fine there. Then I noticed the file name associated with this error: ?v=1.11.0

After searching in the source code of the page for this I found the following:

script("http://benohead.com/?v=1.11.0").wait()

So it’s trying to load some JavaScript file but the name got lost and it ended up loading the main page. And HTML code doesn’t really parse well when you expect JavaScript. Thus the error with the DOCTYPE…

Since I was using the WordPress plugin “WP deferred javaScript” I immediately thought it might have something to do with it and disabled it. And the problem was gone…

If you have the same problem it might not be caused by the same plugin but the cause is most probably that some HTML code is loaded in a <script> tag. Always first check the JavaScript file name shown by FireBug it will directly lead you to the script tag in question.

Note that this error doesn’t only occur when you directly reference an HTML page instead of a JavaScript file. It can also occur when you have an empty src attribute like:

<script type="text/javascript" src=""></script>

Or if you point to a JavaScript file which doesn’t exist or an empty JavaScript file.

Leave a Reply

Your email address will not be published. Required fields are marked *