Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to block IE8 and down?

We just finished developing a web application and we want to block Internet Explorer 8 and down. What is the best way to accomplish this?

I found a way to block IE6, however the tutorial (http://css-tricks.com/ie-6-blocker-script/) is from 2008 and I feel like it's a bit dated. We also want to block IE 7 and 8...

The site is built in CodeIgniter with a lot of Backbone.js.

If anyone has any ideas they would be appreciated.

Thanks!

UPDATE

Sorry guys, more information: Yes I want to BLOCK them, I want to display a message and be able to style the page to say "Sorry, you use Internet Explorer which isn't a web browser, please download CHROME here".

like image 852
user1696090 Avatar asked Mar 07 '13 15:03

user1696090


2 Answers

Do it with CSS and conditional comments.

<head>
    <!--[if IE lte 8]>
    <link rel="stylehseet" type="text/css" href="blockIE.css" />
    <[endif]-->
</head> 
<body>
    <div class="yourcontent">
        ...
    </div>
    <div class="notification">
        <h1>Sorry, we don't support your old browsers</h1>
    </div>
</body>

CSS:

body * { display: none }
.notification { display: block; }
like image 55
Ryan Kinal Avatar answered Nov 05 '22 20:11

Ryan Kinal


You can also do it with CodeIgniter, https://www.codeigniter.com/user_guide/libraries/user_agent.html

Something like:

$this->load->library('user_agent');
if ($this->agent->browser() == 'Internet Explorer' && $this->agent->version() <= 8){
    //Redirect or show error
}

(Also answered here: Code Igniter - Best way to detect browser)

like image 33
Barryvdh Avatar answered Nov 05 '22 21:11

Barryvdh