Are you tired of visitors still using the obsolete and buggy IE6? We are. With yesterday’s launch of Internet Explorer 8, there is little excuse to not upgrading. But for those who insist on using this platform, you can warn them that your site is not (purposely) optimized for their viewing.
Here’s how to display a message only to IE6 users, asking them to upgrade their prehistoric browser.
The first thing to do is to create a style for our message. To do so, paste the following code in your style.css file:
#ie-message { background:#C00; text-align:center; border-bottom:1px solid #900; color: #fff; position:absolute; top:0; padding:5px; width:100%; } #ie-message a { color: #fff; }
Once done, open header.php and paste this code just after the <body> tag:
<!--[if lte IE 6]> <div id="ie-message"> Your browser is obsolete. Please upgrade to <a href="http://www.getfirefox.com" target="_new">Mozilla Firefox</a>. </div> <![endif]-->
Save the file and you’re done. Only IE6 users will see that message asking them to upgrade.