Let Internet Explorer 6 Behave Like Internet Explorer 7

Author: Stefan Vervoort | Please Comment!

We all hate Internet Explorer 6 because the lack of support for CSS and the security issues it has. The browser is 7 year old and dated, but is still used by too many people.

Before we are finally ready to make our websites only work in the modern browsers, we have to deal with this problem. One solution could be the IE7.js JavaScript library.

What is the IE7.js JavaScript library?

IE7.js is a JavaScript library to make Internet Explorer 6 behave like Internet Explorer 7, a more modern browser. This library fixes many CSS and HTML issues developers are constantly trying to deal with.

What bugs does IE7.js fix?

Many CSS properties are supported by most modern browsers but not by IE6: IE7.js solve these problems. IE7.js also fixes many IE6 bugs that annoyed us from day one. Here are the most important ones:

CSS Selectors

  • parent > child
  • .multiple.classes
  • :hover
  • :first-child
  • [attr]
  • [attr="value"], [attr~="value"], [attr|="value"], [attr^="value"], [attr$="value"]
  • [attr*="value"]

CSS

  • Background-image - PNG alpha transparency (IE5.5+)
  • Background-attachment - Support fixed positioning
  • Position - Support fixed positioning
  • Margin - Support auto (IE5.x)
  • Cursor - Support pointer for IE5.x
  • Display - Convert list-item to block for IE5.x

HTML

  • img - PNG alpha transparency
  • abbr - Bug fixed

How to implant this library to your website?

Yes I am sure you are. Next we will implant the library into your website. You can do that by adding this code between the <head></head> tags.

<!--[if lt IE 7]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE7.js" type="text/javascript"></script>
<![endif]-->

It sounds to good to be true, right?

There is only one real disadvantage of this library. Like any other JavaScript script, it won’t work unless JavaScript is activated on the computer of the user.

The change exists that IE6 users have turned off JavaScript because of the security risks IE6 has. And if that’s the problem, IE7.js won’t work, and so won’t the features you have implanted.

With the result your website might not show correctly on these computers. So, you still have to make sure your website works in IE6 if Javascript is turned down and that doesn’t solve the whole IE6-hate-thing.

Further reading and links

If you want more information about this JavaScript library, be sure to visit the following links:

The IE8.js file

I decided to focus this article on IE7.js because that solves the most common bug fixes a normal developer would require and because Internet Explorer 8 is still in BETA. If you decide to use the IE8.js file instead of the IE7.js file, here’s how to do that:

<!--[if lt IE 8]>
<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
<![endif]-->

Note: You don’t need to include the IE7.js if you are using IE8.js.

Liked this post? Subscribe, or Share and Enjoy:
  • Digg
  • del.icio.us
  • Blogosphere News
  • Design Float
  • description
  • StumbleUpon
Tags:

34 Comments. Add yours!

  1. init2me
    7:24 pm on November 17th, 2008

    great script, going to test it…
    hate the padding and box modell problem, what can i do?

  2. Veselin Todorov
    8:51 pm on November 17th, 2008

    There are many articles about the padding and box model around the net. Go for em! Google is your best friend :)

  3. Santhos Webdesign
    9:19 pm on November 17th, 2008

    This certainly sounds to good to be true! I will definitely try it out!

    About the ‘doesn’t work when javascript is disabled’ issue: besides boycotting Internet Explorer 6 I think people who disable javascript in their browser should be ignored too!

    I mean, where’s the internet without javascript…

  4. Joe
    9:42 pm on November 17th, 2008

    Does this work with repeating transparent PNG background images? All the other “PNG fix” scripts I’ve found don’t support repeat-x/repeat-y.

  5. Boiss
    12:01 am on November 18th, 2008

    For double padding when used with width or height, set the css style

    _display:inline;

    Note that the underscore is to make that property apply only to IE6.

  6. Tom
    5:12 am on November 18th, 2008

    More interesting would be a script that makes IE7 behave like IE6. Not sure, instead of using this, it would be better to just upgrade to IE7, unless someone is running Win98 or Win2k.

  7. Tadeusz Szewczyk
    10:08 am on November 18th, 2008

    I tried it back then when it was first introduced but it didn’t work out well enough. There always was a flicker before the script got fully loaded in which the page looked like crap.

    Btw. your comment section is broken in FF2.

  8. Matt P
    11:39 am on November 18th, 2008

    Will this fix ie6 layout bugs as well? i.e. peekaboo, floated double margins etc

  9. justin
    11:41 am on November 18th, 2008

    am i the only one or does this not work?

  10. Micheil
    1:20 pm on November 18th, 2008

    Hmm.. maybe this is just me, or I’m doing something seriously wrong, but I can’t see this javascript fix library fixing anything in any way, shape, or form.

  11. rockstar
    3:33 pm on November 18th, 2008

    That sounds good . nice post !!

  12. Tertius
    5:31 pm on November 18th, 2008

    Hacks hacks and more hacks.

    I hope this problem will change…

  13. Timothy
    9:21 pm on November 18th, 2008

    “IE7.js is a JavaScript library to make Internet Explorer 6 behave like a modern, standards-compliant browser.”

    Is this saying that this script makes IE6 work like IE7, and that IE7 is thus standards-compliant (and modern)? If so, that is horribly, horribly false. IE7 has corrected some of the woes of IE6, but still has left a collection of headaches. Any experience web developer would surely agree.

  14. Stefan Vervoort
    9:33 pm on November 18th, 2008

    @Timothy - Of course, you are absolutely right. IE7 isn’t a standards-compliant browser. IE7 did correct many of the bugs that IE6 has and has become much easier to work with (for me that would be). I will correct this error in the article.

    @Double margin - You can google these problems up. This library don’t have a solution for the double margin problem. There is a customized solution of IE7.js (also available on the Google Code page) that does fix the bug.

    @Doesn’t work - If you have implanted the javascript file correctly, it should work. If not, please let me know what the problems are.

  15. Stefan Matei
    1:44 am on November 19th, 2008

    Very interesting concept. I do have some doubts (sounds too good to actually work well enough), but I’m trying it in my next project.

    So thank you Stefan!

  16. Sumesh
    3:05 pm on November 20th, 2008

    I had read about ie7.js earlier - and it did sound too good to be true. Most of my designs are minimalist and hence look almost perfect in IE6. It seems more designers will use it as IE6 users refuse to upgrade it.

  17. binocle
    1:31 pm on November 22nd, 2008

    You can also decide to throw all that IE6 support away …
    Users won’t abandon it by themselves, we have to push them and show them how bad IE6 render websites.
    If webdesigners still spend hours to fix things to render properly in IE6, that f*** browser will still be here in 10 years.
    Stop supporting it, and kindly explain to your visitors why you do that, and why they should upgrade or change their browser.

  18. Stefan Vervoort
    3:17 pm on November 22nd, 2008

    Yes, but small sites shouldn’t do that. It doesn’t have impact. If google/msn/yahoo etc (and all newspapers and more) point users to a modern browser, we should see people change. If the small blogs and sites do that we barely see change, that’s the difference.

  19. binocle
    5:01 pm on November 22nd, 2008

    I don’t agree. If more and more small sites, blogs drop ie6 support and put warnings and update advises, more and more people will be tented to change their browser, instead of getting 10 times a day a “your browser is a old crappy thing” popup message in the face ^__^

  20. M@nd3le
    11:27 am on November 25th, 2008

    please add “clear:right;” to “.commentlist li” style in style.css on line 613 :) comments will be readable on FF2 :)

    btw: nice site:) \o/ d(^_^)b

  21. Stefan Vervoort
    5:50 pm on November 25th, 2008

    Hey M@nd3le, you are awesome! Didn’t found the time to fix the bug but thanks to you it was a piece of cake! Really made my day! :) If you need any help with anything, be sure to let me know!

  22. top rated music bans
    6:44 pm on November 25th, 2008

    I used to have lot of problems with ie6 at my job and with my hobby projects too. I’ve figured out some workarounds for most of them but not all. Now I will test this js library and see how it works. Thanks for the share dude

  23. bebo skins
    1:35 am on November 28th, 2008

    how about microsoft stop making a cruddy browser and just leave mozzilla or opera do their jobs for them

  24. Michael "Vendor Lock-in" Howell
    1:28 am on January 1st, 2009

    @bebo skins: That’s easy. IE has a lot of bugs related to standards, but also implements a lot of proprietary features (ActiveX, anyone?). The hope is that web developers will simply use the bugless proprietary interfaces instead of the buggy standard ones. At least, that used to be the plan (let’s hope they’ve given up w/IE8).

  25. Michael "Wrong answer to the right problem" Howell
    1:31 am on January 1st, 2009

    Put simply, IE[78].js addresses the right problem (unlike the JavaScript frameworks, such as YUI) that IE sucks. The right answer would, of course, be for M$ to fix their browser (more likely, rewrite it) or for nobody to use or develop for it.

  26. Scott Roberts
    11:57 pm on January 3rd, 2009

    This is awesome. I’m going to link back to this article, Stefan.

  27. Stefan Vervoort
    12:46 pm on January 4th, 2009

    Thanks Scott, thanks for hanging around!

Trackbacks

  1. links for 2008-11-17 - Life according to Itto
  2. Useful Links (18/11/2008) | Apramana
  3. Geek Week - This week jQuery tutorials, CSS3, & WordPress - PHP, XHTML, Web Design, Flash | JasonCypret.com
  4. CSS: Resolvendo bugs no IE6 | Blog do Camillo - O dia-a-dia de um Desenvolvedor Web
  5. Transformer IE6 en IE7 avec un JavaScript | bbxdesign
  6. ????? ??? Internet Explorer 6 ?? ?????????????? ??? Internet Explorer 7! | Tsevdos.com
  7. ?? ???????? links - ????????? 08 | Tsevdos.com

leave a reply

This blog is a DoFollow blog. This means your URL counts as a backlink. Some basic HTML is allowed. Please keep all comments constructive, polite and on-topic. Any spam or offensive comments will be deleted.