...

View Full Version : Browser blocking



estrugo
03-30-2003, 12: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?

joh6nn
03-30-2003, 12: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.

oracleguy
03-30-2003, 12: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)
http://www.javascriptkit.com
Credit must stay intact for use*/
var n=navigator.appName
var ie=(n=="Microsoft Internet Explorer")
if (ie)
location="page.htm"
else
location="wrongbrowser.htm"
//-->
</script>


Try that out.

pardicity3
03-30-2003, 01: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:

cg9com
03-30-2003, 03:00 AM
have fun detecting for opera :rolleyes:
http://javascriptkit.com/javatutors/navigator.shtml
may help ...

this seems like a JS question? :)

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

this seems like a JS question? :)

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

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

Quiet Storm
03-31-2003, 06: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)
document.location.replace('xBrowser.html');

else if (is_ie5up && is_win)
document.location.replace('index.htm');

else
document.location.replace('xSystem.html');
//-->
</script>

estrugo
04-03-2003, 12: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

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

Quiet Storm
04-03-2003, 02: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

brothercake
04-03-2003, 11:30 PM
You can use IE conditional comments - http://www.javascriptkit.com/howto/cc2.shtml

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum