473,326 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Script to detect IE, if not redirect

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
17 6557
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
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

"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

"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
"__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
"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
"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
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

"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
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
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
"__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
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
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
"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
"__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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andy R. | last post by:
Hello everyone, I've spent quite some time now, looking for some information on how to get this done, sadly none has helped me much, though. I have a bit of java scrpt on a webpage (.php) to...
6
by: Sentinel | last post by:
how can i place a script in body (it must be ran automaticly when html interpreter reaches it) that will redirect to another page? what i am doing is checking in php if login is successful...
2
by: Daniel | last post by:
how to detect who redirects traffic to a aspx page? is this info passed along in request object or can sites anonymously redirect traffic to other sites?
0
by: Tim | last post by:
Hello, I'm trying to use a very simple case of MS Passport: Detect if a user is logged in via MS passport; if yes then return the username, else redirect to the Microsoft-hosted login site. ...
1
by: pdc | last post by:
I have two web servers that I use, one is the primary and the other is a backup for when the server is down. I use a third, central server which redirects a browser's initial link to one of my...
4
by: pdc | last post by:
have two web servers that I use, one is the primary and the other is a backup for when the server is down. I use a third, central server which redirects a browser's initial link to one of my web...
4
by: goscottie | last post by:
I used submodal as my popup window. With some tweaks, it working great in my app. However, I can't find a way to detect session timeout in the popup window. The app is a form based...
7
by: jeddiki | last post by:
Hi, As I am in Turkey at present, I can not see vidoes on youtube. So I have tried a few proxies but keep finding them slow or not working. So I have installed myphpProxy on my server under...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.