Script to detect IE, if not redirect

R

Randy Webb

James said:
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.
 
J

James

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
 
C

Chiwa

James said:
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;
 
X

__x__Yoehoe__x__

James said:
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>
*********************
 
R

Richard Cornford

<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.
 
R

Richard Cornford

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.
 
L

Lasse Reichstein Nielsen

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
 
M

Mark Preston

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.
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
Richard Cornford
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" .
 
K

kaeli

And:-
Konquerer, Safari, NetFront, Web Browser, iCab, IceBrowser, Opera 7 and
Operas 5 & 6 (when spoofing IE)


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.



--
 
X

__x__Yoehoe__x__

Richard Cornford said:
And:-
NetFront, Web Browser, IceBrowser, Operas 5, 6 & 7 (when spoofing IE),
Konquerer (when spoofing IE) and others.


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.


How many browsers are left to take the "Other Browsers" branch?


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
 
J

James

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
 
L

Lasse Reichstein Nielsen

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
 
K

kaeli

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/author/dhtml/overview/ccomment_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
 
J

Jim Ley

Please trim your quotes.


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.
 
R

Richard Cornford

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.
 
R

Richard Cornford

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top