Detect IE6 browser
I just happened to browse TWF using an old computer with no other browser than IE6, yay! I was greeted this message.
Hello, you're using an outdated version of Internet Explorer: some elements of this Web site will not be displayed correctly.
We would be very appreciative if you switched to a more standards compliant browser, such as Opera or Firefox. Whilst we support any modern browser, we think you'll probably like one of those best.
I just want to ask how can I do this to my site, about 15% of my visitors are using IE6 according to my Google Analytics report and my equations do not render correctly in this browser. That means, I lost some 1500 visitors every month.
I am using Drupal. I tried looking around and I found this code:
<?php
$browser = $_SERVER['HTTP_USER_AGENT'];
//running internet explorer
if($msie = strpos($browser, "MSIE"))
{
//version number
$ver = substr($browser, $msie + 5, 3);
if($ver < 7.0)
{
return TRUE;
} else {
return FALSE;
} else {
return FALSE;
?>
and this code:
<?php
$browser = $_SERVER['HTTP_USER_AGENT'];
//running internet explorer
if($msie = strpos($browser, "MSIE"))
{
//version number
$ver = substr($browser, $msie + 5, 3);
if($ver < 7.0)
{
echo '
Welcome!
<br /><br />
It appears you\'re using Microsoft Internet Explorer '.$ver.'.
<br />
Since Microsoft does not wish to fix this ancient and bug-ridden browser, the developer of this site has refused to support it.
<br /><br />
Before you can proceed to this site you will need to upgrade to a modern browser, such as FireFox or Internet Explorer 7.
';
exit();
}
}
?>
I like the first as it says, it would control the block visibility but unfortunately, I don't know how to implement it, where should I put the warning. I tried the next one but my page will show only the warning, no other else.
Megan posted this at 16:12 — 25th August 2009.
She has: 11,421 posts
Joined: Jun 1999
I had to look at the code to see how this was set up. We have a function in our template.php to send this through our ad tracker. That way we can count how many people see it.
But, the display of the message is just handled with conditional comments:
<!--[if lt IE 7]><?php if(function_exists("advertcode")) {print advertcode(9);} ?><![endif]-->
If you wanted to keep it simple you could just put your message into the conditional comment there. I could post the advertcode function but it's not really relevant unless you're using phpadsnew.
Megan
Connect with us on Facebook!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.