Reputation: 64834
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>...
Upvotes: 26
Views: 84902
Reputation: 1
I had the same problem. After trying many solution and searching about it, finally I got why I was getting that error.
I was getting that error because of invalid path in src attribute of script tag. Like I was adding script as below by simply dragging script on page from solution explorer in visual studio and I was getting error. My src attribute in script tag was src="~/js/jquery.min.js"
And I found that I was not getting script on that page.
So I used below solution to load script on that page. src attribute in script tag src="../../js/jquery.min.js"
Upvotes: 0
Reputation: 711
I had the same issue. For me the problem was that I loaded a script file that pointed to nowhere or to be more precise it pointed to my domain root. The script declaration was <script src="http://mydomain/" type="text/javascript" />
. What was happening was that the script was loading my home page. The first character of a home page is "<" because all html pages start with "<!DOCTYPE ......"
. Well this is a syntax error so and that was it. Once I eliminated <script src="http://mydomain/" type="text/javascript" />
everything was ok. I hope I helped you.
EDIT: In short, check your src
pointers on your Javascript links to be sure they point at the correct files.
Upvotes: 2
Reputation: 1038710
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.
Upvotes: 27
Reputation: 3569
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.
Upvotes: 2
Reputation: 943108
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)
Upvotes: 15