• Home
  • About
  • Doom II
  • Flog
  • Inspiration

Internet Explorer 6, JavaScript, and YOU

Posted in Computing. on Wednesday, August 1st, 2007 by Derek
Aug 01

Lately, I ran into two mentally challenged issues when it came using JavaScript in IE6.

  1. My first mistake was writing the line:

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

    The browser’s inability to properly parse XHTML leads it to ignore all tags beneath this line as it believes it to be part of the <script> definition, but just throws it all away as tag soup. Correct usage in XHTML:

    <script type="text/javascript" src="editEvent.js"></script>
  2. The second issue made me want to pound my head against a wall. Keeping in mind my script was working fine in Firefox, the error I received in IE6 on my work PC was, “Object Expected at line 1, character 1″. Since it was the first time I had written code to dynamically build a table using DOM, I figured it was just an issue with IE6 not supporting some of the methods I used. However, when I tried the same page on my home PC with the same version of IE, it now said, “Object Expected at line 51, character 1″, which was the point where I made my first call to a JavaScript function that didn’t involve DOM code. I used the Firebug extension for Firefox to ensure my JavaScript code was sound. Thanks to the Dow Jones and Rimwad, it was discovered that Apache Web server was sending my separate .js file as document type “application/x-javascript” rather than “text/javascript”. IE6′s parser didn’t know what the fuck. A simple fix of MIME types in Apache’s httpd.conf and it worked. And the disciples said, “what a big fucking lizard, Lord”.
  • Now Playing: KMFDM - Tohuvabohu - 10 - Fait Accompli

2 Comments

  1. Jon on August 3rd, 2007

    I came across the first issue with Opera. Not sure if it accepts shorttags now, though.

  2. JonR on August 11th, 2007

    Actually, the script tag behaviour is in line with the XHTML spec, which says the tag contains PCDATA and therefore cannot be minified. See this page for a bit more info: http://lists.evolt.org/archive/Week-of-Mon-20020304/105951.html

    Therefore, IE6’s behaviour is, while not helpful, not technically incorrect.



Leave a Reply

CAPTCHA Image
Refresh Image
*

Derek MacDonald


  • Photo Stream
  • Categories
    • Australia
    • Computing
    • Film & TV
    • Food
    • Gaming
    • General
    • Music
    • Sports
    • Visual Art
  • Search






  • Home
  • About
  • Doom II
  • Flog
  • Inspiration

© Copyright Derek MacDonald. All rights reserved.
Designed by FTL Wordpress Themes brought to you by Smashing Magazine

Back to Top