0

SOLVED Argh. I HATE when this happens. It was just me being stupid. I didn't allow crtypto-js.googlecode.com to run javascript in NoScript. Sorry for bothing you, and thank you all for your help!

Update It works for other people in Firefox, and it works for me in Internet Explorer. SO this sin't related to the HTML code itself it seams. I might head over to SuperUser if nobody has an idea here. (ANd yepp - I have tried emptying the cache ^^)

I just ran into a strange problem. In a XHML document, I'm loading three javascript libraries. One loads, two don't. When checking with firefox internal web developer console, I see no requests issued for the two, so it's not wrong paths or anything (I would see requests returnign 404).

Minimal Example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en"
      xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd">
  <head>
    <script type="text/javascript" src="//crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/hmac-sha1.js" />
    <script type="text/javascript" src="//crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js" />
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" />
    <script type="text/javascript"></script>
  </head>
  <body>
  </body>
</html>

Screenshot of browser console: Screenshot of all requests

What's going on here? Sourcecode looks fine to me, and the script tags loading CryptoJS are structured the same way as the one that loads jQuery. Still, jQuery loads while the others don't.

[Edit]: JUst to make that one clear in case more people are about to answer the same: self-closing the emtpy script-tags is fine. It's valid XHTML, and the current verwsion of FIrefox is fully XHTML compliant and understands this. If you read that you should not do this somewhere - that's right, you shouldn't. Because you could still meet old, non-XHTML-compliant browsers. But this is a private test-project that will never be used anywhere outside my own browser, So this is a non-issue here.

Johannes H.
  • 5,875
  • 1
  • 20
  • 40

2 Answers2

1

<script> cannot be self-closing, as shown by the syntax highlighting in your question.

Always close scripts with </script>.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
  • 2
    I was under the impression that I could self-close any element that does not have content in XHMLT when sending with the appropriate content-type (which I do)? This is allowewd in pure XML at least, and neither DTD nor XSD has any way to specify elemments that cannot be self-closed. Still - changing it makes no difference, and the jQuery-one works the way it is. – Johannes H. Feb 07 '14 at 03:57
  • 2
    According to http://stackoverflow.com/a/206409/1048572, they can. – Bergi Feb 07 '14 at 04:00
  • You just shouldn't do this, in case you meet non-XHTML-compliant browsers. But it's valid XHTML, as XHTML is a XML dialect, and XML allows self-closing for EVERY element (as long as its empty). The current version of Firefox IS fully XHTML compliant, and I'm sending the xhtml+xml content-type, too. THIS is NOT the problem here. – Johannes H. Feb 07 '14 at 04:03
  • @JohannesH., whether it's valid or not is irrelevant, have you tried actually closing the ``, which would explain why no subsequent HTTP requests are made. – zzzzBov Feb 07 '14 at 04:23
  • @zzzzBov I did, as mentioned above. Plus, the page is parsed as XML, the document structure is just right in the development console, it includes the closing script tags, so firefox knows the elements were closed. It doesn't work if I change the order of the scripts BTW, sam result: jQUery works, others don't. (and, as doctype, xml-declaration and content-type header are all properly set, there is no reason for firefox not to parse it as XHTML. but of course, yes, one should still verfiy) – Johannes H. Feb 07 '14 at 04:37
0

Problem solved. NoScript blocked the two Javascripts.

Johannes H.
  • 5,875
  • 1
  • 20
  • 40