tags:

views:

75

answers:

2

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"&gt;
<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>...
+1  A: 

Checkout this blog post.

Darin Dimitrov
Thanks! The point is that all my scripts have "src". I mean, if I remove the last 2 lines (<script>) in the <head> then I don't get the issue. But they both have already src attriute
Patrick
Yes but are they real javascript? What is the `Content-Type` returned by the server?
Darin Dimitrov
oh you're right! one of them is considered html.. what am I doing wrong then ? The content of the first script (for example, is just a jquery function).. I don't think it is formatted badly
Patrick
Your server send wrong Content-Type.
Darin Dimitrov
uhm, how can I change it ? I'm actually storing it on my localhost and my local apache always worked correctly so far. Also, on another website on the same localkhost I don't have issues
Patrick
+1  A: 

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)

David Dorward
well, you see in the code they point to a js file. And in Firebug it is found (not 404 error is returned)
Patrick
Putting `.js` on the end of a URL doesn't make it a JS file. Servers (with some very rare exceptions) send HTML documents as the body of 404 errors. Sometimes they are misconfigured so they 404 error body comes with a 200 status code.
David Dorward
what makes a js file then ? I just have javascript in it. thanks
Patrick