Script to detect IE, if not redirect

Discussion in 'Javascript' started by Randy Webb, Feb 4, 2004.

  1. Randy Webb

    Randy Webb Guest

    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/
     
    Randy Webb, Feb 4, 2004
    #1
    1. Advertising

  2. Randy Webb

    James Guest

    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
     
    James, Feb 4, 2004
    #2
    1. Advertising

  3. Randy Webb

    kaeli Guest

    In article <>,
    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
     
    kaeli, Feb 4, 2004
    #3
  4. Randy Webb

    Chiwa Guest

    "James" <> schreef in bericht
    news:...
    > 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;
     
    Chiwa, Feb 4, 2004
    #4
  5. "James" <> wrote in message
    news:...
    > 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>
    *********************
     
    __x__Yoehoe__x__, Feb 4, 2004
    #5
  6. "__x__Yoehoe__x__" <> wrote in message
    news:FydUb.1970$-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.
     
    Richard Cornford, Feb 4, 2004
    #6
  7. "Chiwa" <> wrote in message
    news:BvdUb.542$-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.
     
    Richard Cornford, Feb 4, 2004
    #7
  8. "Richard Cornford" <> writes:

    > "Chiwa" <> 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 -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Feb 4, 2004
    #8
  9. Randy Webb

    Mark Preston Guest

    On 4 Feb 2004 09:35:00 -0800, (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.
     
    Mark Preston, Feb 5, 2004
    #9
  10. JRS: In article <bvrr5b$eap$1$>, seen in
    news:comp.lang.javascript, Richard Cornford
    <> 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.
     
    Dr John Stockton, Feb 5, 2004
    #10
  11. Randy Webb

    kaeli Guest

    In article <bvrr5b$eap$1$>,
    enlightened us with...
    > "Chiwa" <> 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
     
    kaeli, Feb 5, 2004
    #11
  12. "Richard Cornford" <> wrote in message
    news:bvrr4v$ead$1$...
    > "__x__Yoehoe__x__" <> wrote in message
    > news:FydUb.1970$-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
     
    __x__Yoehoe__x__, Feb 5, 2004
    #12
  13. Randy Webb

    James Guest

    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 <> wrote in message news:<>...
    > 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.
     
    James, Feb 5, 2004
    #13
  14. "__x__Yoehoe__x__" <> 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 -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Feb 5, 2004
    #14
  15. Randy Webb

    kaeli Guest

    In article <>,
    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/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
     
    kaeli, Feb 5, 2004
    #15
  16. Randy Webb

    Jim Ley Guest

    On Thu, 05 Feb 2004 19:41:09 +0100, Lasse Reichstein Nielsen
    <> wrote:

    >"__x__Yoehoe__x__" <> 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/
     
    Jim Ley, Feb 5, 2004
    #16
  17. "kaeli" <> wrote in message
    news:...
    <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.
     
    Richard Cornford, Feb 5, 2004
    #17
  18. "__x__Yoehoe__x__" <> wrote in message
    news:wOvUb.536$G%-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.
     
    Richard Cornford, Feb 5, 2004
    #18
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?VHJveQ==?=

    Response.redirect does not redirect from .aspx page

    =?Utf-8?B?VHJveQ==?=, Oct 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    5,328
    Srowe1975
    Oct 15, 2008
  2. Sal
    Replies:
    1
    Views:
    902
  3. Ron Howard
    Replies:
    2
    Views:
    558
    Ron Howard
    Aug 11, 2004
  4. inetquestion
    Replies:
    0
    Views:
    159
    inetquestion
    May 6, 2009
  5. JJA
    Replies:
    2
    Views:
    167
    Dr J R Stockton
    Oct 28, 2006
Loading...

Share This Page