Skip to content

Uncaught SyntaxError: Unexpected token < into DOCTYPE html PUBLIC

I am having a series of JavaScript problems and the only thing I notice in the console.log is:

Uncaught SyntaxError: Unexpected token <

Which leads me to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">

I can not see a syntax error here. Is there any syntax error in this line? How can I fix it?


The error message indicates a JavaScript syntax error.

The code you quoted is XHTML, which is not JavaScript. Trying to treat it as JavaScript (as you are doing) is doomed to failure.

This is probably caused by entering the wrong URL in a src attribute.