0

I'm trying to make a simple strict HTML file that includes jquery:

<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en">

  <head>

    <title>Test File</title>

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

  </head>

<body>

</body>
</html>

But Firefox displays the following errors in the error console when I try to load it:

Error: d.style is undefined
Source File: http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js
Line: 33

Error: jQuery is not defined
Source File: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js
Line: 19

Help! I don't understand :(

Colen
  • 13,428
  • 21
  • 78
  • 107
  • Add `type="text/javascript"` to the ` – Jake Wharton Apr 22 '10 at 02:06
  • Thanks - added, but it doesn't seem to change the errors that I get. – Colen Apr 22 '10 at 02:12
  • I just tested the above i dont get any errors...check the encoding of your html file, make sure is utf-8 – Luis Apr 22 '10 at 02:19
  • I tested as well, and nothing came up. Perhaps your version of Fx might help. What version of Firefox are you using? – Dustin Apr 22 '10 at 02:19
  • 2
    Is the site served as text/html or application/xml+xhtml? – deceze Apr 22 '10 at 02:21
  • Thanks deceze! I was loading the file locally, and it had a .php extension - once I changed it to .html, it worked great. Submit that as an answer and I'll accept it. :) – Colen Apr 22 '10 at 02:29
  • If you can figure out more details, please contribute to the "XHTML and Javascript" section here: http://stackoverflow.com/questions/2662508/html-4-html-5-xhtml-mime-types-the-definitive-resource/2662582#2662582 :) – deceze Apr 22 '10 at 02:34

1 Answers1

1

Is the site served as text/html or application/xml+xhtml?

(It was supposed to be a question, but apparently it was the answer.)

deceze
  • 510,633
  • 85
  • 743
  • 889
  • 1
    Yet another case of "Sending XHTML as text/html Considered Harmful" < http://hixie.ch/advocacy/xhtml > ? -_- – Dustin Apr 22 '10 at 02:35