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>.
Post this entry to: » del.icio.us » Digg » Furl » Newsvine » reddit » Y!
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. 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. > 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????