Back in August of 2006, I published Redirection with Smoke And ... Smoking. Among other things, the article described what the experience was like for visitors to Marlboro.com:
If you were using something other than Internet Explorer, you likely experienced a familiar sight: a blank page as a result of the site being coded for IE only. In and of it self, that's not too big of a deal, even for #20 on the Fortune 500 List, Altria.
The fun part, however, was why Marlboro.com only worked in IE. To redirect visitors to actual content, they programmatically set the HREF property of a hyperlink on the page and then executed the (IE-Only) click() method on that hyperlink. That meant a noticible redirect for Internet Explorer and a dead page for everyone else.
Here's what the code looked like back in 2006:
<html> <head> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <title>Coupons and special offers from Marlboro</title> <meta name="keywords" content="marlboro cigarettes, marlboro miles" /> <meta name="description" content="" /> </head> <script language=javascript> <!-- function redirect() { var anchorObj = document.getElementById("target1"); anchorObj.href = "http://smokersignup.com/signup/index.jsp?pc=MAR2006"; anchorObj.click(); } //--> </script> <body onload="javascript:redirect();"> <a id="target1" href="#"></a> </body> </html>
And here's what the page looks like today:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <title>Coupons and special offers from Marlboro.</title> <script language="javascript"> function redirect() { var name = navigator.appName; if(name == "Microsoft Internet Explorer") { try {document.getElementById("link").click();}catch(ex){loc();} } else { loc(); } setTimeout("check()",1000); } function loc() { location = "http://www.smokersignup.com/signup/index.jsp?pc=MAR2006"; } function check() { document.getElementById("the_div").style.display = "block"; } </script> </head> <body onload="redirect()"> <div id="the_div" style="display:none;"> Redirecting... <br /> <br /> If your browser does not redirect you momentarily, please click <a id="link" href="http://www.smokersignup.com/signup/index.jsp?pc=MAR2006">here</a> </div> </body> </html>
Without compromosing their original vision — the pioneering idea of redirection via simulated mouse click — they've added some features:
- It now works in non-IE browsers, thanks to the try/catch and the new loc() function,
- it now has a teases the user via setTimeout, making the user's anticipation and excitement grow for a full second until they're redirected, and
- it's almost accessible to users without JavaScript. "Almost" because it unhides the div that tells non-JavaScript users what to do... via JavaScript. Maybe this will be fixed in 3.0?
No longer supported:
- <meta> tags were removed; now how will search engines circa 1996 know how to index the content?
We'll keep you updated as new features and enhancements are added.
UPDATE: I forgot to mention, Marlboro.com is running ASP.NET on IIS, as evidenced by these two different 404 errors.