Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent IE6 visitors

How can I drop the using of IE6 to browse my website ?
Something like :
if ie6 => die
I am using ASP.Net
Thanks

like image 527
Israa Abd Avatar asked May 08 '11 20:05

Israa Abd


3 Answers

In asp.net you can look at the Request.Browser in Session_start and do what you want from there. Perhaps Response.Redirect("www.getfirefox.com")

protected void Session_Start(Object sender, EventArgs e) {
    var browser = Request.Browser;
    if (browser.browser == "Whatever IE is" 
        && browser.version == "your least fave version" )
        Response.Redirect("www.getfirefox.com");
}

See msdn for the httpbrowsercapabilities class

You may want to show a banner on your website. Microsoft are running a campaign to get people off IE. Check out http://www.theie6countdown.com/ the banner is on http://www.theie6countdown.com/join-us.aspx

As others will no doubt answer there are many ways to detect browser version.

Conditional css comments

<!--[if IE 6]>

and Javascript

alert( BrowserDetect.browser + ' ' + BrowserDetect.version); 

are 2 other ways.

like image 82
Johnno Nolan Avatar answered Sep 21 '22 00:09

Johnno Nolan


If you want, this can be done also with conditional comments:

<!--[if lt IE 7]>
<script type="text/javascript">
    window.location = "someplace.html";

    // Or maybe suggest other things, i.e. a browser upgrade, installing Chrome Frame etc.
</script>
<![endif]-->
like image 28
Erick Petrucelli Avatar answered Sep 21 '22 00:09

Erick Petrucelli


You can look at the user agent header and if it is IE 6 redirect to a specific page.

Here is a handy list of IE user agent strings, grouped by version.

like image 25
Oded Avatar answered Sep 22 '22 00:09

Oded