loading comments

IE6 Browser Warning Message

Posted on: July 27, 2009 Categories: CSS, Internet
Internet Explorer 6 Logo

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. This small addition to your webpage will display an IE6 specific message to any IE6 user.

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:


IE6 message

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.

I'm James, I'm 18 years old and I'm a freelance website developer from Nottingham, England. I have a passion for website development and have designed websites for a range of clients in my freelance years. James' Blog is my personal blog where I post articles and general posts whenever I can. I typically like talking website development, but you'll find a range of posts and articles here on my blog.

  • http://web-kreation.com Jeeremie

    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

    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

    @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 :)

  • http://thomasmaier.me Thomas Maier

    You do not need that. Check out http://browser-update.org/ it provides all what you need and is decent to your customers.

  • http://www.james-blogs.com James

    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.

  • http://cyan-light.co.uk/ Apostropartheid

    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.

  • http://www.james-blogs.com James

    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

  • http://websitegraveyard.wordpress.com Spen B

    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!

  • http://www.james-blogs.com James

    Sounds great! Thanks for commenting!

  • http://www.mediahubuk.com MediaHub Website Design

    Great tutorial, very easy to implement, makes a big difference and aids major problem of IE6 incompatibilty

  • http://florian-fiegel.net/ie6-optimierung-1 Keine IE6-Optimierung für dieses Blog – Florian Fiegel

    [...] sich hierhin verirren aber nicht ganz komisch vorkommen, habe ich mich entschieden einen kleinen Warnhinweis per Conditional Comment einzubinden.Generell muss ich mich aber noch mit der Kompatibilität zu anderen Browsern und [...]

  • http://www.modhalo.net Phil

    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…

  • tracyanne

    You didn’t go far enough, you should have suggested they upgrade to a more secure, more standards complaint browser, anything other than Internet Explorer.

    Other than that, great. I’ll use it for my site, and follow my own advice.

blog comments powered by Disqus