Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want my site to block access to visitors that are using outdated browsers such as IE6 and IE7 etc.

I am looking for a script that I can use to block certain browsers accessing my site

share|improve this question
May I ask why do you want to block them?! – Omne Sep 19 '12 at 14:35
The only real reason for not supporting (different from "blocking") older browsers is that your web project not only makes use of, but requires the latest and most advanced browser to function. Is that your scenario? If so, what scripting environment are you using? – msanford Sep 19 '12 at 15:23
I'm blocking them because I can't be bothered supporting them. It might even be technically feasible to support even IE6 but as I'm a solo developer have to choose new features vs legacy browser support and chose the first. Only site access stats can tell me I'm wrong :) – Lorenzo Sep 19 '12 at 15:41
Hmm... but don't do that! IMO start with a simple design which supports older browsers too, then expand it for new technologies. believe me, you'll loose a lot with blocking older browsers, there are many people who still use them, people who never upgrade their default IE... if youo're website is live atm, your stats should confirm this. even websites created solely for new browsers have some level of support for older ones... – Omne Sep 19 '12 at 15:48
"better practices" and "blocking access to legacy browsers" - isn't that a contradiction?! – w3dk Sep 19 '12 at 21:17

You can detect older versions of Internet Explorer using the IE Conditional Comments feature. The following snippet when included in a web page will redirect versions older than IE 8 to a separate page -

<!--[if lt IE 8]>
<SCRIPT LANGUAGE="javascript">

You can also choose to hide the page's content by setting the container tag's display property style to none via JavaScript.

The browser can also be detected through server-side code.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.