Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML DOCTYPE Syntax error

Tags:

html

I get the following syntax error in Firebug and I don't get what's it:

> syntax error [Break on this error]
> <!DOCTYPE html PUBLIC "-//W3C//DTDXHT...org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n

Is it because of the final "\n" at the end ?

thanks

ps. I've just realized if I remove all scripts, I don't get that error. For example, if I remove these lines, I don't get it. If I add another script I get it again, so it doesn't depend on the script itself.

<script type="text/JavaScript" src="<?php echo $base_url; ?>sites/all/themes/bluemarine/js/main.js"></script>

CODE:

<?php
// $Id: page.tpl.php,v 1.28.2.1 2009/04/30 00:13:31 goba Exp $
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<?php print $language->language ?>" xml:lang="<?php print $language->language ?>" dir="<?php print $language->dir ?>">
<head>
  <?php print $head ?>
  <title><?php print $head_title ?></title>
  <?php print $styles ?>
  <?php print $scripts ?>
  <script type="text/JavaScript" src="<?php echo $base_url; ?>sites/all/themes/bluemarine/js/main.js"></script>
  <!--<script type="text/JavaScript" src="<?php echo $base_url; ?>sites/all/themes/bluemarine/js/griddy-min.js"></script>
-->

</head>

<body>...
like image 411
aneuryzm Avatar asked Sep 25 '10 09:09

aneuryzm


3 Answers

Ryan Rampersad, blogged about this issue stating

The error comes from Firebug. The break on this error isn’t a part of the error but it is in the firebug copy dump....

syntax error [Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML…3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

The way I encountered this error was that I forgot to specify a src attribute value for my script tag!

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

Here is the blog post.

like image 56
Darin Dimitrov Avatar answered Nov 14 '22 08:11

Darin Dimitrov


I suspect that you have a <script> pointing to a URL that returns an HTML document (possibly it should be coming with a 404 response but isn't)

like image 31
Quentin Avatar answered Nov 14 '22 06:11

Quentin


In my case, when I received such error, the cause was "un authorised access" to the JS file.

To detect it, use FireBug, [HTML] tab: Try to expand each "script" node. one of these nodes contained the "401.html" page-content instead of the expected JS content.

like image 2
Atara Avatar answered Nov 14 '22 06:11

Atara