A project I’m working on at the moment requires users to be running cutting edge browsers (Firefox 3+, Chrome, Safari 5, Opera 10 or IE9), so I needed a way to redirect users to a landing page directing them to upgrade. I didn’t want to rely on Javascript, nor did I want to have a block of ugly PHP for processing it, and most of all I didn’t want to be a dick to my users. Here’s what I came up with.
First, my .htaccess file:
RewriteCond %{REQUEST_FILENAME} !^.png [nc]
RewriteCond %{REQUEST_FILENAME} !^.css [nc]
RewriteCond %{REQUEST_FILENAME} !^.jpg [nc]
RewriteCond %{REQUEST_FILENAME} !^.js [nc]
RewriteCond %{REQUEST_FILENAME} !^.gif [nc]
RewriteCond %{HTTP_USER_AGENT} "Firefox/2" [or]
RewriteCond %{HTTP_USER_AGENT} "Firefox/1" [or]
RewriteCond %{HTTP_USER_AGENT} "Flock/1" [or]
RewriteCond %{HTTP_USER_AGENT} "Camino/1" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/9" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/8" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/7" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/6" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/5" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/4" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/3" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/2" [or]
RewriteCond %{HTTP_USER_AGENT} "Opera/1" [or]
RewriteCond %{HTTP_USER_AGENT} "Safari/4" [or]
RewriteCond %{HTTP_USER_AGENT} "Safari/3" [or]
RewriteCond %{HTTP_USER_AGENT} "Safari/2" [or]
RewriteCond %{HTTP_USER_AGENT} "Safari/1" [or]
RewriteCond %{HTTP_USER_AGENT} "Navigator/" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 6" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 5" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 4" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 3" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 2" [or]
RewriteCond %{HTTP_USER_AGENT} "MSIE 1"
RewriteRule . upgrade.html [L]Obviously, this requires mod_rewrite to be enabled on your Apache installation. I’m far from an .htaccess expert, and this could probably be optimized. Finally, the landing page itself.
Dead simple and to the point. I remain unbiased on the users choice of browser, but make my recommendations based on security track records and web standards support.
IE9 is a huge step forward for Trident from its previous iterations, but it still lacks a lot of the best aspects of CSS3 and HTML5, which is why I gave it a “Good” rather than a “Great” recommendation. As of this writing Firefox 4 and Internet Explorer 9 are both still in Beta, so I would obviously not be using this configuration unmodified until those are released, but my project is still some time off from release.
How do you feel about browser landing pages? Do you feel this is the right way to handle this? I’d like to hear your thoughts.

Share the Love
Similar Posts
Twitter
Subscribe