updated in 2010
How to detect IE
Push the Internet Explorer users to switch to Firefox. Just copy the HTML snippet or the PHP script into your webiste or blog. This warning is invisible to readers using another browser.
Optionally check if the browser is compatible with your web app. You can check the evolution of browser stats here.
Less IE please
Webmasters are tired of supporting Internet Explorer 6 or 7. Therefore you could stop the support of IE6 in your CSS files. Also do your users a favour and give them an alternative.
Not more Google please
 Chrome lighter reignites a browser war
There is another problem: Google is locking down competition on the Web. There are privacy concerns: collecting user data and monitoring your browsing. There are relevancy concerns. There also are anti-trust concerns.
The means to Web domination include owning the dominant search engine and controlling most of the web browsers. This in turn is done by promoting their own browser (Chrome) and by contracting with Mozilla: by default the Firefox search box triggers the Google engine. So please give the Mozilla foundation the means to stop their contract with Google. You can do that by promoting the use of Firefox -- rather than that of Chrome.
HTML snippet
You can add HTML to any web page. A proposal to switch shows only to users of older IE versions:
There is no need to detect Chrome Frame if Chrome Frame activates automatically. The trick is to combine the above Internet
Explorer conditional comments with the Chrome meta-tag: <meta http-equiv="X-UA-Compatible" content="chrome=1" />. Chrome Frame detects the Chrome meta-tag; thus the page is rendered by Trident, but by WebKit.
This snippet is simple but less flexible than the PHP script further down -- which also checks for Chrome Frame.
What the scripts do
I have created both a HTML snippet and a PHP script that pushes users to switch to a relevant browser. They work as follows:
A user triggers her browser to ask for your page (across the Web).
The page served is different depending on the user agent. A message only shows on the web page only if the client uses a "bad" browser. The piece of code detects the browser used and displays an upgrade message only if the browser version is bad.
The message can be anything. By default it proposes to switch to Firefox. You can choose what you consider bad by editing the $announcement between the simple quotes on line 15 in the PHP script below.
PHP code for detecting IE and Chrome Frame
Die Internet Explorer!
Implementing this is fairly straightforward. If you have a blog here is a Wordpress plugin that works in a similar — but different — manner.
If you do not have a Wordpress blog, please use my PHP code herebelow. You can insert it into most HTML files.
Note on Chrome Frame: you may simplify the script by removing the test of Chrome Frame. The above implementation considers that the user have their own idea about which browser to use if they have installed Chrome Frame. Most IE6 users are trapped within that browser because the Intranet applications on their corporate network do not work in any other browser -- not even IE7.
This script issues a warning to only those clients who cannot use your webapp -- I mean a website who would use a snappy (AJAX) user interface.
You may reuse and propagate this script with either one of two licenses:
This alternative allows the use of the "Die IE!" code in a variety of software projects, while still maintaining copyleft on the said code. So choose the license and adapt the code to your needs. Usage: launch an editor, open your HTML or PHP file, copy and paste the above script, change the French detection (on line 11) to your own language (if not English).
|