Common JavaScript issues in the Internet Explorer.

All of us have spent many hours to reveal and fix JavaScript issues that raised errors under IE. In this article we will cover some of them.

The complete list of the IE7 / IE8 bugs, including JS interpretation flaws can be found here:
http://www.gtalbot.org/BrowserBugsSection/MSIE7Bugs/

  1. IE will raise an error if the “comma” symbol exists after the last element of an array.

    Example
    :

    var array = ["elem1", "elem2", "elem3",]


    Solution
    : Remove the comma after the last element and let the browser be happy.

  2. Support of JavaScript reserved keyword const, that declares a read-only, named constant.

    Example
    :

    const varname1 = value1;


    Description
    : const is a Mozilla-specific extension, it is not supported by IE. However Firefox 2, Safari 2, Opera 9.2x, NS 6.2, Galeon 2, Epiphany 2 all pass this test.

    Solution
    : Replace the const keyword with var.

  3. MSIE does not support type=”application/ecmascript” and type=”application/javascript” in the Script tag, which meet RFC 4329.

    Example
    : <script language=”javascript” type=”application/javascript” … />

    Solution
    : If you don’t care about XHTML compliance or expressiveness of your markup, it’s safe to use a plain script tag. If you do care, you should use “text/ecmascript” or “text/javascript”.
3 Comments

3 Comments

  1. Hello from Vyatka River!!! Thank you for information! It?s a good idea for next full revision…
    Write more!!! :)))

  2. Great post! Keep up the good work!

  3. Keep the awesome posting up. Thanks for this!

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>