Duplicate
Why don’t self-closing script tags work?
I'm writing an ASP 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>
Duplicate
Why don’t self-closing script tags work?
I'm writing an ASP 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>
Share
Improve this question
edited Jun 20, 2020 at 9:12
CommunityBot
11 silver badge
asked Feb 22, 2009 at 11:41
Oz RadianoOz Radiano
7892 gold badges11 silver badges30 bronze badges
1
- this is part of the standard, script tags cannot be self closed. – DevelopingChris Commented Feb 27, 2009 at 2:00
3 Answers
Reset to default 14The HTML4.01 manual section defining the SCRIPT
element, states:
18.2.1 The SCRIPT element
...
Start tag: required, End tag: required
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.
<script>
can only self-close in XHTML, not HTML.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744905016a4600202.html
评论列表(0条)