View Full Version : Browser blocking

03-30-2003, 01:12 AM
Do somebody know how to "block" or prevent a user from accessing a page from other navigators than IE; in a way that they have an alert telling to install IE or something, not redirecting to an alert page?

03-30-2003, 01:37 AM
you could do that any number of ways. i think you need to ask yourself if you really want to, though. there are a lot of people ( like myself ) who don't use IE, and you could end up losing a substantial number of visitors that way. and what about people who use screen readers and such?

you'd be better of just designing your site to work only in IE. that way, people using other browsers could still get to the site, they just wouldn't have the benefit of all your cool stuff.

personally, i recommend cross browser coding, to reach the largest audience.

03-30-2003, 01:38 AM
Yes you can but its not a very good practice unless there is something very specific you are doing, like mentioned above.

Nevertheless, look at this script: http://www.javascriptkit.com/script/cut5.shtml

You should be able to use it with a minimal editing. Like:

<script type="text/javascript">
/*By George Chiang (JK's JavaScript tutorial)
Credit must stay intact for use*/
var n=navigator.appName
var ie=(n=="Microsoft Internet Explorer")
if (ie)

Try that out.

03-30-2003, 02:22 AM
If you absolutley can't code cross browser, just do what Joh6nn said and code for IE. If it would make you feel more comfortable you could always do a little javascript detect and, if someone is using a browser that isn't IE, print a little message at the top that says "This page works best in IE!"

Please don't block the page unless it is absolutley necessary:eek:

03-30-2003, 04:00 AM
have fun detecting for opera :rolleyes:
may help ...

this seems like a JS question? :)

03-30-2003, 06:04 AM
Originally posted by cg9com

this seems like a JS question? :)

Yeah but you also could do it server-side too.

03-30-2003, 07:33 AM
JS thread then. :D:D:D

Quiet Storm
03-31-2003, 07:01 AM
Originally posted by cg9com
have fun detecting for opera

The trick is to detect Opera first, before looking for IE.

My example:

<script language="JavaScript">
if (is_opera && is_win)

else if (is_ie5up && is_win)


04-03-2003, 01:51 AM
Thanks to everybody, in fact I wanted this stuff for an Intranet browser based program, not for web use.

Anyway you were very helpful and my work is done.
Thanks a lot

04-03-2003, 02:57 AM
What if people on that Intranet turn JavaScript off then? :D

Quiet Storm
04-03-2003, 03:38 PM
Originally posted by meow
What if people on that Intranet turn JavaScript off then? :D

Too bad for them - they'll be missing out. :p

04-04-2003, 12:30 AM
You can use IE conditional comments - http://www.javascriptkit.com/howto/cc2.shtml

But obviously I don't approve ... [mumble]