Recently I've been talking about Internet Explorer 6 and how support for it is slowly dropping, and soon we will see it disappear for good, but there are still people that use this browser, whether it by choice or that they are forced to, you have to keep in mind that people will view your site in Internet Explorer 6, but these days it is very hard to get modern CSS 2.1 websites to display 100% in Internet Explorer 6 without hacking your code to hell and back. If your a person which doesn't believe in having all these invalid hacks in your code but wants to get the message across saying "This website is not IE6 compatible" then you can use a small script using Conditional comments.
You may hate Internet Explorer 6 with a passion, but you have to be rational here. You could simply add a script to your website which completly blocks Internet Explorer 6 users completly, but really whats the point in that? Like I said while it may be a minority of users that use Internet Explorer 6, there still traffic none the less. So straight blocking them is a tad harsh no? Instead the more rational method is to create a message that displays to IE6 users only. Which we will create now:
Conditional Comments
For people that haven't already heard of Conditional comments they are basically browser specific messages which hide in your source code unless the actual browser it references is being used to display the website. Conditional comments are one of the great methods of creating CSS hacks for your website to display in older browsers, but we can also use them to display certain content to a specific user that uses the referenced browser. Here's the code we're going to use:
<!--[if lte IE 6]>
<div id="ie-message">
It appears you are viewing this webpage in Internet Explorer 6. This website is not compatible with Internet Explorer 6 and therefore by using Internet Explorer 6 to view this website you may encounter horrible design errors and weird layout problems. It is recommended that you update your Internet Explorer Browser installation to at least Internet Explorer 7 or above. You can do this by <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">clicking here</a>
</div>
<![endif]-->
Place this code on wherever you want the message to appear. I placed mine before any content so a Internet Explorer 6 user could clearly see the message. You place it wherever you see fit.
Style the IE6 Warning Message
If you were to view the message in Internet Explorer 6 right now it would work but probably not look great, this is because we need to style the message with CSS. You'll notice in the code I had already included a div called ie-message all you need to do is open up your websites main stylesheet and add in this:
#ie-message {
background:#db2e2e;
border:1px solid #333;
color: #fff;
padding:15px;
font-size:14px;
font-weight:bold;
letter-spacing:-1px;
margin-bottom:10px;
}
#ie-message a {
color:#fff;
text-decoration:underline;
}
You may want to modify this styling information to fit your website design. But thats all you need to do. So now when someone using IE6 views your website they will see this message telling them they are using a browser which you don't support, a friendly message rather than straight blocking IE6 traffic which really when you think about it is very extreme and quite frankly stupid.
Viewing your website in Internet Explorer 6
So you probably want to test out your website to make sure this message is appearing. Now most of us have Internet Explorer 8 installed and as you know the Internet Explorer Installation overwrite any current browser version so how can you view your website in Internet Explorer 6. There are a couple of simple ways. One easy option is to install something called Multiple IEs which will allow you to run Internet Explorer Versions 3, 4, 5 and 6 it essentially emulates the browser allowing you to use it as if it was the full installation, or if you really don't want to install anything you can use a website called BrowserShots which is a free service which allows you to screenshot your website in all different types of browsers which then you can check to see if everythings displaying correctly. There the main methods I'd use.
And finally here's the screenshot of what my Internet Explorer 6 message looks like:
My message is slightly different to the one in the example code as mine is slightly personal. But thats what it looks like if you use the code above! Enjoy.











Jeeremie
August 2nd
Hopefully, with Youtube and Digg.com dropping support for IE6, a lot of people will be forced to upgrade IE6 to IE7 or later or even download a better browser.
I can't wait to see IE6 be dropped completely.
Marc
August 2nd
Alternatively, you can also give the visitors the choice of the browser they wish to use, like the "Bye Bye IE6" initiative does (http://www.byebyeinternetexplorer.org)
James
August 2nd
@Jeeremie Yes support for IE6 has already and will eventually end. But like you said seems the big boy websites Digg, YouTube are putting there IE6 hacks and stylesheet to bed I think thats probably a insentive to other to also follow the crowd.
@Marc That is a interesting script. However personally I'd rather have my actual website to still be displayed, even if it doesn't display properly so at least you don't cut off IE6 Traffic, though I checked recently and a total of 200 people have used IE6 to view my website out of total traffic of over 70,000 so it's not that much, but traffic is traffic.
Thanks for your comments both of you
Thomas Maier
August 2nd
You do not need that. Check out http://browser-update.org/ it provides all what you need and is decent to your customers.
James
August 2nd
Again, that is a very neat concept, literally an add the script and your done job. Which is great, but in my opinion some of the browsers included in that script shouldn't be there. Yes there old, but some aren't that old and therefore it is also up to the website designer to at least attempt to be compatible with older browsers. Because not everyone updates to new things instantly.
Apostropartheid
September 22nd
This would be perfect if you had a close button which sets a cookie to not show it again. There's a fair chance your site will be at least readable in IE6 if you've written semantically, and people still on IE6 probably don't have a choice, so let them get on with it without annoying them further.
James
September 23rd
True but even the most semantic CSS and XHTML may still not display properly in IE6, but I see you point. I think I will implement as soon as possible. Thanks for your suggestion and taking the time to comment
Spen B
October 3rd
This is a great tool! I'm working on a wiki that, like many modern websites that use newer versions of CSS, displays horribly in Internet Explorer 6. Now I can tell users that everything will be displayed properly by upgrading IE, or even better, switching to Firefox or Chrome. Thanks!
James
October 3rd
Sounds great! Thanks for commenting!
MediaHub Website Design
October 13th
Great tutorial, very easy to implement, makes a big difference and aids major problem of IE6 incompatibilty
Phil
December 1st
Nice tutorial. I'm currently designing a business website for an insurance company. They were running IE6 because of compatibility issues with software they used, up until just recently I had them upgrade to IE7 at the minimum. I'm trying to decide whether I should go this route, or with something like a Javascript popup posted above. I wonder how many users using IE6 will have Javascript disabled...