By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,747 Members | 1,533 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,747 IT Pros & Developers. It's quick & easy.

Script to detect IE, if not redirect

P: n/a
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/

Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.

Thanks for all help :)

James
Jul 20 '05 #1
Share this Question
Share on Google+
17 Replies


P: n/a
James wrote:
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/
Why?
Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.
I bet it can't, reliably be done.
Thanks for all help :)


Stop trying to determine my browser, it will ultimately fail. What
reason do you have for discriminating against non-IE browsers? A
solution could probably be found. (that does *not* include browser
detection). Read the FAQ (link in sig) with regards to browser detection
in general.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #2

P: n/a
In article <5d**************************@posting.google.com >,
ki******@virgin.net enlightened us with...
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/


Why?
I'll just set my Opera to spoof as IE. Or turn off script.

Use object detection, not browser detection.

--
--
~kaeli~
To steal ideas from one person is plagiarism; to steal from
many is research.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3

P: n/a

"James" <ki******@virgin.net> schreef in bericht
news:5d**************************@posting.google.c om...
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/

Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.

Thanks for all help :)

James

Maybe this helps (a bit)

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

Jul 20 '05 #4

P: n/a

"James" <ki******@virgin.net> wrote in message
news:5d**************************@posting.google.c om...
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/

Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.

Thanks for all help :)

James


*********************
<script language="JavaScript">
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
//if IE 4+
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location = "http://www.xxx.com/1.htm"
//if NS 4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location = "http://www.xxx.com/2.htm"
//if OTHER
else
window.location = "http://www.xxx.com/1.htm"
</script>
*********************

Jul 20 '05 #5

P: n/a
"__x__Yoehoe__x__" <_A********************@pandora.be> wrote in message
news:Fy*******************@phobos.telenet-ops.be...
<snip>
<script language="JavaScript">
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
//if IE 4+
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location = "http://www.xxx.com/1.htm"
And:-
NetFront, Web Browser, IceBrowser, Operas 5, 6 & 7 (when spoofing IE),
Konquerer (when spoofing IE) and others.
//if NS 4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location = "http://www.xxx.com/2.htm"
And:-
Safari, Operas 5, 6 & 7 (when spoofing Netscape), Konquerer (when
spoofing Netscape), Mozilla, K-meleon, Gostzilla, Doczilla,
Pheonix/Firebird and other Gecko based browsers.
//if OTHER
else
window.location = "http://www.xxx.com/1.htm"
How many browsers are left to take the "Other Browsers" branch?
</script>


This style of script is not capable of browser detection at all and,
given the same browser may take different branches depending on user
preferences, it is probably worse than useless.

Richard.
Jul 20 '05 #6

P: n/a
"Chiwa" <Ch******@hotmail.com> wrote in message
news:Bv********************@hebe.telenet-ops.be...
<snip>
I have searched the web for a script that detects ...
<snip>Maybe this helps (a bit)

isNS4 = (document.layers) ? true : false;
And:-
Escape and Omniweb
isIE4 = (document.all && !document.getElementById) ? true : false;
And:-
Omniweb (again)
isIE5 = (document.all && document.getElementById) ? true : false;
And:-
Konquerer, Safari, NetFront, Web Browser, iCab, IceBrowser, Opera 7 and
Operas 5 & 6 (when spoofing IE)
isNS6 = (!document.all && document.getElementById) ? true : false;


And:-
iConnector, NetBox, Operas 5 & 6 (when not spoofing IE), Mozilla,
K-meleon, Gostzilla, Doczilla, Pheonix/Firebird and other Gecko based
browsers.

This style of script is not capable of browser detection at all.

Richard.
Jul 20 '05 #7

P: n/a
"Richard Cornford" <Ri*****@litotes.demon.co.uk> writes:
"Chiwa" <Ch******@hotmail.com> wrote in message

isIE4 = (document.all && !document.getElementById) ? true : false;


What Richard said! And then, the "? true : false" is not necessary.
Just write:
var isIE4 = (document.all && !document.getElementById);
It is a complete waste to write
(boolean expression)?true:false;
when the boolean expression gives the result directly.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #8

P: n/a
In article <bv*******************@news.demon.co.uk>,
Ri*****@litotes.demon.co.uk enlightened us with...
"Chiwa" <Ch******@hotmail.com> wrote in message

And:-
Konquerer, Safari, NetFront, Web Browser, iCab, IceBrowser, Opera 7 and
Operas 5 & 6 (when spoofing IE)
isNS6 = (!document.all && document.getElementById) ? true : false;


And:-
iConnector, NetBox, Operas 5 & 6 (when not spoofing IE), Mozilla,
K-meleon, Gostzilla, Doczilla, Pheonix/Firebird and other Gecko based
browsers.

This style of script is not capable of browser detection at all.

Richard.


Geez, I haven't even heard of some of these browsers!

This is the best example of why browser detection is a bad idea.

--
--
~kaeli~
Local Area Network in Australia:... the LAN down under.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #9

P: n/a

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:bv*******************@news.demon.co.uk...
"__x__Yoehoe__x__" <_A********************@pandora.be> wrote in message
news:Fy*******************@phobos.telenet-ops.be...
<snip>
<script language="JavaScript">
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)
//if IE 4+
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
window.location = "http://www.xxx.com/1.htm"


And:-
NetFront, Web Browser, IceBrowser, Operas 5, 6 & 7 (when spoofing IE),
Konquerer (when spoofing IE) and others.
//if NS 4+
else if (browser_type=="Netscape"&&browser_version>=4)
window.location = "http://www.xxx.com/2.htm"


And:-
Safari, Operas 5, 6 & 7 (when spoofing Netscape), Konquerer (when
spoofing Netscape), Mozilla, K-meleon, Gostzilla, Doczilla,
Pheonix/Firebird and other Gecko based browsers.
//if OTHER
else
window.location = "http://www.xxx.com/1.htm"


How many browsers are left to take the "Other Browsers" branch?
</script>


This style of script is not capable of browser detection at all and,
given the same browser may take different branches depending on user
preferences, it is probably worse than useless.

Richard.


How many people use IE en NS ?
99,5 %
How many use the other browsers ?
0,5 %
Pffffffffffffffff
Jul 20 '05 #10

P: n/a
Hi,

I understand it cant be done 100% reliably. The problem I am
facing is that the website was designed with dropdownmenus and
a flash underneath it. The dropdowns hide under the flash in
non IE browsers (even after we put a transparent code in there).
We cant redesign the site as client insists
he wants to keep that exact look, but for other browsers remove
the flash. We have decided the best way is any NON ie browsers to go to page
xyz... Please help if you can with a script that will do the above if you can.
I understand the problems, but this is the best solution in this instance.

Thanks

James



Randy Webb <hi************@aol.com> wrote in message news:<jo********************@comcast.com>...
James wrote:
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/


Why?
Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.


I bet it can't, reliably be done.
Thanks for all help :)


Stop trying to determine my browser, it will ultimately fail. What
reason do you have for discriminating against non-IE browsers? A
solution could probably be found. (that does *not* include browser
detection). Read the FAQ (link in sig) with regards to browser detection
in general.

Jul 20 '05 #11

P: n/a
JRS: In article <bv*******************@news.demon.co.uk>, seen in
news:comp.lang.javascript, Richard Cornford
<Ri*****@litotes.demon.co.uk> posted at Wed, 4 Feb 2004 22:19:22 :-
isIE4 = (document.all && !document.getElementById) ? true : false;
...
This style of script is not capable of browser detection at all.

But it seems capable of non-browser detection (a spoof should be
honoured; that is the spoofer's intent)

notIE4 = !(document.all && !document.getElementById)

But the utility of the result is not so obvious.
Among those of mid-westerly longitude, there seems to be a strange
feeling that "A implies B" implies "B implies A" whereas over here
we know that it implies "not-B implies not-A" .

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 20 '05 #12

P: n/a
"__x__Yoehoe__x__" <_A********************@pandora.be> writes:

Please trim your quotes.
How many people use IE en NS ?
99,5 %
How many use the other browsers ?
0,5 %
Pffffffffffffffff


No need for a browser detect then, eh?

I don't know the exact numbers. I doubt they can be known. But I am
absolutely certain that the number of other browsers is larger than a half
percent. More likely somewhere between five and twentyfive percent.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #13

P: n/a
In article <5d**************************@posting.google.com >,
ki******@virgin.net enlightened us with...
Hi,

I understand it cant be done 100% reliably. The problem I am
facing is that the website was designed with dropdownmenus and
a flash underneath it. The dropdowns hide under the flash in
non IE browsers (even after we put a transparent code in there).
We cant redesign the site as client insists
he wants to keep that exact look, but for other browsers remove
the flash. We have decided the best way is any NON ie browsers to go to page
xyz... Please help if you can with a script that will do the above if you can.
I understand the problems, but this is the best solution in this instance.


Perhaps using IE conditionals is your best bet then.

http://msdn.microsoft.com/workshop/a...comment_ovw.as
p

Just put the flash in IE only.

--
--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #14

P: n/a
On Thu, 05 Feb 2004 19:41:09 +0100, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
"__x__Yoehoe__x__" <_A********************@pandora.be> writes:

Please trim your quotes.
How many people use IE en NS ?
99,5 %
How many use the other browsers ?
0,5 %
Pffffffffffffffff


No need for a browser detect then, eh?

I don't know the exact numbers. I doubt they can be known. But I am
absolutely certain that the number of other browsers is larger than a half
percent. More likely somewhere between five and twentyfive percent.


The FAQ's website gets 3% of its traffic from Google alone... (not the
FAQ itself but the site as a whole)

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #15

P: n/a
"kaeli" <ti******@NOSPAM.comcast.net> wrote in message
news:MP************************@nntp.lucent.com...
<snip>
iConnector, NetBox, Operas 5 & 6 (when not spoofing IE), Mozilla,
K-meleon, Gostzilla, Doczilla, Pheonix/Firebird and other
Gecko based browsers.

This style of script is not capable of browser detection at all.
Geez, I haven't even heard of some of these browsers!


I did spell Ghostzilla wrong (itís a fun Gecko variant - "Ghostzilla,
the clandestine browser" designed to make it easy for people to browser
when they should be working. It has monochrome display modes and opens
its windows over the view area of other applications so they are
inconspicuous, and they vanish if you mouse out of them).

I am getting the impression that no matter how many browsers you can
name there are always going to be an least another couple that you have
never heard of (and that's just the Javascript capable ones).
This is the best example of why browser detection is a bad idea.


Yes, the browser detecting by object inference technique requires a
detailed knowledge of the DOMs of *all* web browsers (and may still not
be practical even then). But it is not practical to become familiar with
all web browsers, and it seems that the people familiar with the largest
numbers of browsers are least convinced that it will ever be possible to
know about them all. So a strategy that makes an impossible task a
pre-requisite for its effective implementation is certainly a bad idea.

It is a good thing that we already have a viable alternative.

Richard.
Jul 20 '05 #16

P: n/a
"__x__Yoehoe__x__" <_A********************@pandora.be> wrote in message
news:wO*****************@phobos.telenet-ops.be...
<snip>
//if OTHER
else
window.location = "http://www.xxx.com/1.htm"
How many browsers are left to take the "Other Browsers" branch?
</script>


This style of script is not capable of browser detection at
all and, given the same browser may take different branches
depending on user preferences, it is probably worse than
useless.


How many people use IE en NS ?
99,5 %
How many use the other browsers ?
0,5 %


It doesn't work as an argument because the people who gather the
statistics have to use one of the browser detecting techniques - UA
strings, other navigator properties or object inference. As those
techniques cannot effectively distinguish the majority of non IE or
Netscape browsers from IE and Netscape browsers, statistics that say no
more than that the majority of browsers cannot be distinguished from IE
do not mean that those browsers actually are IE.

That is: Statistics that would require effective browser detection (at
the very least) in order to be meaningful cannot justify browser
detecting as a strategy.
Pffffffffffffffff


?

Richard.
Jul 20 '05 #17

P: n/a
On 4 Feb 2004 09:35:00 -0800, ki******@virgin.net (James) wrote:
Hi Guys,

I have searched the web for a script that detects if they have any
other browser then IE 4 and above, it needs to go to
www/domain.com/other_browsers/
Why?
Im sure it can be done, but cant find the exact script. I have found
variations, but really need 'if not IE then move to the above url'.

I'm not sure it CAN be done - not reliably anyway. And I'm sure that
it SHOULD NOT be done, in any case.
Jul 20 '05 #18

This discussion thread is closed

Replies have been disabled for this discussion.