IE script tag problem
Issue:
The page not displayed in IE. "View Source" shows the full source, <title> is displayed OK, but the page is not blank. White screen of death. Nothing.
Cause:
<script type="text/javascript" src="some.js" />
Solution:
<script type="text/javascript" src="some.js"></script>
Comments:
It's probably this whole thing with the current support of XHTML. Most browsers (in their forgiveness for HTML authoring errors) interpret XHTML as HTML with some weirdly placed slashes and other noise. So for example they see <br /> as a slightly broken <br>. More about this here.
In the case above probably IE needs the end </script> tag and because it cannot find it, it treats the whole HTML document as JavaScript, apparently broken. Hence the white page with OK source and OK HTML title.
... And while on the script tag subject, "language" is not a valid XHTML Strict attribute for <script>.
This entry was posted on Tuesday, October 18th, 2005 and is filed under (x)HTML(5). You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

October 19th, 2005 at 12:51 am
I once wasted a full working day on this stupid problem. I finallly found the solution by applying the very last kind of stuff I always apply to a problem: trying things that sound really stupid but you’re trying them anyway out of pure despair. It’s completely ridiculous! Good to post about it because I’m sure I haven’t been the only one struggling with this ‘feature’ of Internet Explorer
October 20th, 2005 at 7:05 am
This solution seems preety valid both for HTML and XHTML:
and coud be used for any empty elements
October 20th, 2005 at 7:57 am
Yes, DeadMoroz, it is. The problem was that IE won’t support the shorthand syntax for empty elements.
July 27th, 2006 at 10:17 am
“The problem was that IE won’t support the shorthand syntax for empty elements.”
Which ultimately means that IE si not abiding by the PUBLISHED standard. Can’t they read?
November 13th, 2006 at 10:50 pm
[...] Here I was thinking that my old TTC map was only helping a few dozen people a day. In goes my updated map and up go my visits by several hundred per day. It turns out that I was closing the Google Analytics script tag in the XML style (ie. <script …/>) and not as <script …></script>. The culprit? IE, of course, which doesn’t support the former. [...]
March 23rd, 2007 at 4:23 am
A year and a half afer your post, this stupid IE behavior just costed me some hours. I could trace the problem, but it is always good to find a confirmation for the results of ones trial&error. Thanks!
April 12th, 2007 at 11:45 am
I had the same problem at work. Because I am using xsl to generate the page
gets translated to
so I was forced to use (a dot before the ending tag).
.
I hope IE fixes this bug soon.
April 12th, 2007 at 11:49 am
sorry the tag above did not appear
so basically add a non white space character (in my case a dot)
<script …/>.…></script>
May 12th, 2007 at 8:41 am
Thanks a lot! This is really dumbest problems IE ever came up with. Man I was so close to check the browser Id and redirect to a “Install Firefox!”-page in case of a positive IE check!
And a whole lot of my time!
Thank you, you really saved IE’s a**.
August 13th, 2007 at 10:16 pm
I only wasted 10 minutes on this because of this post… thanks for saving me countless hours!
September 11th, 2007 at 5:28 am
Thanks, that post saved my day…
September 19th, 2007 at 9:55 am
[...] Yes, that’s exactly it; Internet Explorer in particular will ignore everything after a tag if it is not closed with a tag. Using the XML-style closing will not work. http://www.phpied.com/ie-script-tag-problem/ [...]
September 19th, 2007 at 9:57 am
[...] > Yes, that’s exactly it; Internet Explorer in particular will ignore > everything after a tag if it is not closed with a > tag. Using the XML-style closing will not work. > http://www.phpied.com/ie-script-tag-problem/ > > Please note this has nothing to do with Cocoon in particular but is > simply a browser issue. [...]
March 12th, 2008 at 10:07 am
Guys now that we know IE doesn’t support tag….can someone give a work arround as i hav a requirement where I have to use the script tag as . (There is a long story behind this) I have to do this in IE itself (have got no choices)….. Can someone help????
November 11th, 2011 at 2:57 am
new york wallpaper…
[...]IE script tag problem / Stoyan’s phpied.com[...]…
January 29th, 2012 at 4:28 am
hip hop videos for your urban lifestyle, hip hop videos…
[...]IE script tag problem / Stoyan’s phpied.com[...]…
October 22nd, 2012 at 11:56 am
Just so that this is clear to all those who read this in the future, the XHTML 1.0 specification allows the end tag shorthand (self closing tags) on empty elements. Empty elements are not tags that contain nothing, but elements that MUST be empty.
There are only 10 such tags in XHTML:
Notice, script is not one of those tags. Browsers that accept a self closing script tag in XHTML are WRONG, and if you self-close one, please go read the actual XHTML specification that does not allow it before complaining about IE. YOUR code is broken. Fix it.
October 22nd, 2012 at 11:57 am
Sorry, those 10 tags are:
area, base, br, col, hr, img, input, link, meta, and param.
February 19th, 2013 at 6:11 am
When you decide to go for your first date, there are lot of options. Either you can meet your date at the public near Bristol place, at the good restaurant, at yours or date’s house or even go for a movie. Two hours movie date may not be so good to start with. You perhaps don’t want to sit and stare each other and if movie is good, you may get engrossed so much that you might ignore your date.