IE script tag problem

October 18th, 2005. Tagged: (x)HTML(5)

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.


<script type="text/javascript" src="some.js" />


<script type="text/javascript" src="some.js"></script>

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>.

Tell your friends about this post: Facebook, Twitter, Google+

20 Responses

  1. 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 ;)

  2. This solution seems preety valid both for HTML and XHTML:

    and coud be used for any empty elements

  3. Yes, DeadMoroz, it is. The problem was that IE won’t support the shorthand syntax for empty elements.

  4. “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?

  5. [...] 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. [...]

  6. 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!

  7. 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.

  8. sorry the tag above did not appear

    so basically add a non white space character (in my case a dot)

    <script …/>.…></script>

  9. 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!
    Thank you, you really saved IE’s a**. ;) And a whole lot of my time!

  10. I only wasted 10 minutes on this because of this post… thanks for saving me countless hours!

  11. Thanks, that post saved my day…

  12. [...] 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. [...]

  13. [...] > 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. > > > Please note this has nothing to do with Cocoon in particular but is > simply a browser issue. [...]

  14. 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????

  15. new york wallpaper…

    [...]IE script tag problem / Stoyan’s[...]…

  16. hip hop videos for your urban lifestyle, hip hop videos…

    [...]IE script tag problem / Stoyan’s[...]…

  17. 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.

  18. Sorry, those 10 tags are:
    area, base, br, col, hr, img, input, link, meta, and param.

  19. 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.

  20. Your mode of telling all in this piece of writing is truly nice, all
    be capable of simply know it, Thanks a lot.

Leave a Reply