Why do we bother with IE?

October 18th, 2007 by Patrick Leave a reply »

Why do we web developers spend so many hours making web pages work for broken browsers like Internet Explorer? Aside from the technical challenge it’s a complete waste of our collective energy, and every time you implement a work-around you’re giving people one less reason to ditch the non-standards-compliant browser. Ok, if you’re building a site for someone else they’ll probably stipulate that you need to make the site as accessible as possible, so go ahead and apply the hacks for them. But if it’s your own site, what’s your excuse?

Firefox is obviously my browser of choice but there’s also plenty of other alternatives to Internet Explorer. As of today, anyone viewing this site in Internet Explorer will be presented with a message across the top of the site encouraging them to ditch IE for a browser that supports the Open Web.

For those interested in implementing a similar scheme on their wordpress blogs, the code I have used is shown below (a modified version of Markus Opolka’s Anti IE Bar wordpress plugin)


<?php

function wp_anti_ie_bar() {
 $ua = strtolower($_SERVER['HTTP_USER_AGENT']);
 $isOpera = !(strpos($ua, "opera") === false);
 $isIE = !$isOpera && !(strpos($ua, "msie") === false);
 if ($isIE) {
 echo "
<div class="meta">";
 echo "It looks like you're using <strong><a href="http://en.wikipedia.org/wiki/Criticism_of_Internet_Explorer" target="_blank">Microsoft Internet Explorer</a></strong> to browse the web. For the sake of <a href="http://www.alternativebrowseralliance.com/why.html" target="_blank">the open web and the future of the internet</a>, not to mention your own <a href="http://www.mozilla-europe.org/en/products/firefox/features/#experience" target="_blank">web browsing experience</a> and <a href="http://www.mozilla-europe.org/en/products/firefox/features/#secure" target="_blank">security</a>, please do yourself a favour and switch to <a href="http://getfirefox.com" target="_blank">Firefox</a> (follow the link for instructions on how to download and install Firefox).";
 echo "< /div>";
 }
}

function wp_anti_ie_bar_header() {
 if (function_exists ('wp_anti_ie_bar')) {
 wp_anti_ie_bar();
 }
}

add_action('wp_head', 'wp_anti_ie_bar_header');
?>
Advertisement

Leave a Reply