Duplicate
I'm writing an ASP.net page, which have some Javascript code in JS file for client-side authentication.
While using this code prevented from my server-side code from working:
<script src="../../JavaScript/BaseJS.js" type="text/javascript" defer="defer" />
This code somehow worked:
<script src="../../JavaScript/BaseJS.js" type="text/javascript" defer="defer"></script>
Any ideas?
Thanks in advance, Oz radiano.
From stackoverflow
-
<script>can only self-close in XHTML, not HTML.Rex M : Script tag cannot self-close even in XHTML. It is valid XML but browsers choke on it.dreamlax : Get your facts straight. XHTML is XML, therefore a self-closing SCRIPT element is valid XML. It passes XHTML validation therefore it is valid XHTML. Just because some browsers choke on it, doesn't mean I am incorrect.dreamlax : Any proper browser that can handle valid XHTML will accept a self-closed SCRIPT element.Ms2ger : Any browser that implements real XHTML, that is, when sent with the MIME type application/xhtml+xml (e.g., Firefox, Opera, Safari and Chrome) does support self-closing script elements. However, no browser implements *any* self-closing element in HTML, i.e., when sent as text/html, and they shouldn't.dreamlax : IE6 (or IE7, or maybe both) don't support XHTML even when the right MIME type is used. I think it always parses it as HTML, where there's no such thing as a self-closing element as you say. -
Am I right in saying you're testing with IE? This is a known bug. (I'm sure there are lots of other pages referring to it too.)
EDIT: In fact, there's another Stack Overflow question about this too.
-
The HTML4.01 manual section defining the
SCRIPTelement, states:18.2.1 The SCRIPT element
...
Start tag: required, End tag: required
0 comments:
Post a Comment