Redirecting Browsers

Discussion in 'Javascript' started by For Example: John Smith, Aug 23, 2003.

  1. Hi,

    I thought this was simple to do but I have not had any luck. I would
    like to have two versions of my web site which are optimised for
    different browsers. One version for IE and one version for Netscape /
    Mozilla. How do I redirect visitors to different pages based on their
    browser?

    For instance they come to the site and access index.html. If they are
    using IE, index.html continues to load. If they are using Netscape or
    Mozilla, they are automatically redirected to index-ns.html.

    What is the trick to making this work?

    Thank you!

    Reply only to group please!
     
    For Example: John Smith, Aug 23, 2003
    #1
    1. Advertising

  2. For Example: John Smith <> writes:

    > I thought this was simple to do but I have not had any luck. I would
    > like to have two versions of my web site which are optimised for
    > different browsers. One version for IE and one version for Netscape /
    > Mozilla. How do I redirect visitors to different pages based on their
    > browser?


    As an Opera user, I recommend against being that specific.

    > For instance they come to the site and access index.html. If they are
    > using IE, index.html continues to load. If they are using Netscape or
    > Mozilla, they are automatically redirected to index-ns.html.


    Should Netscape 4 be redirected too? It has no more similarity with
    Netscape 6+ than IE does.

    <script type="text/javascript">
    if (navigator.appName == "Netscape") {
    location.href = "index-ns.html";
    }
    </script>

    If you don't want to include Netscape 4, you can add the condition
    parseInt(navigator.appVersion,10)>4

    > Reply only to group please!


    Ofcourse. But you should still have a valid reply address, mr.
    For Example.

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Aug 23, 2003
    #2
    1. Advertising

  3. Interesting, thanks for the info. But why then do I always hear talk of
    browser re-direction? It seems like a popular and widely used "trick"
    on the Internet.

    Jim Dabell wrote:

    > For Example: John Smith wrote:
    >
    >
    >>Hi,
    >>
    >>I thought this was simple to do but I have not had any luck. I would
    >>like to have two versions of my web site which are optimised for
    >>different browsers. One version for IE and one version for Netscape /
    >>Mozilla.

    >
    >
    > What about everyone using other browsers? Why are you doing this in the
    > first place anyway? Usually it's far easier to code each page properly
    > with a modest number of workarounds for each significant browser.
    >
    >
    >
    >>How do I redirect visitors to different pages based on their
    >>browser?

    >
    >
    > You cannot do this reliably. Client-side scripting is unreliable, and
    > server-side approaches rely upon the User-Agent HTTP header, which is also
    > unreliable.
    >
    >
    >
    >>For instance they come to the site and access index.html. If they are
    >>using IE, index.html continues to load. If they are using Netscape or
    >>Mozilla, they are automatically redirected to index-ns.html.
    >>
    >>What is the trick to making this work?

    >
    >
    > Redesign HTTP to make an accurate User-Agent header mandatory, alter all
    > existing user-agents, and get everyone in the world to upgrade.
    >
    >
     
    For Example: John Smith, Aug 23, 2003
    #3
  4. I'm not familiar with Opera? I thought most people used IE now (like 97%
    according to the last survey I read). Anyways, I just wanted to do the
    people using Netscape a favor, see my other post. Thank you for the code
    sample I will recompile to suit my needs.

    Lasse Reichstein Nielsen wrote:

    > For Example: John Smith <> writes:
    >
    >
    >>I thought this was simple to do but I have not had any luck. I would
    >>like to have two versions of my web site which are optimised for
    >>different browsers. One version for IE and one version for Netscape /
    >>Mozilla. How do I redirect visitors to different pages based on their
    >>browser?

    >
    >
    > As an Opera user, I recommend against being that specific.
    >
    >
    >>For instance they come to the site and access index.html. If they are
    >>using IE, index.html continues to load. If they are using Netscape or
    >>Mozilla, they are automatically redirected to index-ns.html.

    >
    >
    > Should Netscape 4 be redirected too? It has no more similarity with
    > Netscape 6+ than IE does.
    >
    > <script type="text/javascript">
    > if (navigator.appName == "Netscape") {
    > location.href = "index-ns.html";
    > }
    > </script>
    >
    > If you don't want to include Netscape 4, you can add the condition
    > parseInt(navigator.appVersion,10)>4
    >
    >
    >>Reply only to group please!

    >
    >
    > Ofcourse. But you should still have a valid reply address, mr.
    > For Example.
    >
    > /L
     
    For Example: John Smith, Aug 23, 2003
    #4
  5. Please direct your attention towards:
    http://www.allmyfaqs.com/faq.pl?How_to_post

    For Example: John Smith wrote:

    > I'm not familiar with Opera?


    http://www.opera.com/

    > I thought most people used IE now (like 97% according to the last survey I
    > read).


    It is impossible to gather accurate statistics relating to browser use.
    Especially as so many people spoof their headers to claim to be IE when
    they are using something else (thanks to the high number of IE-only sites).


    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Aug 23, 2003
    #5
  6. For Example: John Smith <> writes:

    > The problem is with JAVA. I use three freeware JAVA APPLES to do
    > things on my page. Like I use one to draw the background and one to
    > do a banner ad and one to play the background sound. IE displays
    > JAVA flawlessly through the Windows Virtual Machine but Netscape
    > crashes a lot of times because it uses the Sun Virtual Machine.


    I use IE with the Sun JVM, so detecting browsers isn't sufficient.
    It sounds like the fault is with Sun's JVM, but it is Microsoft's
    JVM that is badly broken according to the Java standard (created
    by ... Sun :).

    Also, you don't want to detect Netscape then, but detect anything
    non-Windows-IE, in case you can't detect JVM build.

    > So I want people using Netscape (which Mozilla is derived from)


    It's the other way around. Netscape 6+ is based on the browser
    developed by the Mozilla Project (which was supported by Netscape
    Corp (now bought by AOL et al)).

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Aug 23, 2003
    #6
  7. On Sat, 23 Aug 2003 14:27:25 -0400, For Example: John Smith
    <> wrote:

    > I'm not familiar with Opera? I thought most people used IE now (like 97%
    > according to the last survey I read). Anyways, I just wanted to do the
    > people using Netscape a favor, see my other post. Thank you for the code
    > sample I will recompile to suit my needs.
    >

    that's an old survey. :)

    I use Opera myself, even on my work machine (because it is also my
    preferred mail client). a more recent survey might now i'm in about a 10%
    bracket of users. :)

    keep also in mind that more and more people are installing linux these
    days, which means they probably use one of these browsers:
    Mozilla
    Opera
    Konqueror
    Lynx
    Mosaic

    though i really don't know how many people actually use Mosaic. Lynx is
    much better IMHO. :)

    http://www.opera.com - Opera
    http://www.kde.org - Konqueror

    > Lasse Reichstein Nielsen wrote:
    >
    >> For Example: John Smith <> writes:
    >>
    >>
    >>> I thought this was simple to do but I have not had any luck. I would
    >>> like to have two versions of my web site which are optimised for
    >>> different browsers. One version for IE and one version for Netscape /
    >>> Mozilla. How do I redirect visitors to different pages based on their
    >>> browser?

    >>
    >>
    >> As an Opera user, I recommend against being that specific.
    >>
    >>
    >>> For instance they come to the site and access index.html. If they are
    >>> using IE, index.html continues to load. If they are using Netscape or
    >>> Mozilla, they are automatically redirected to index-ns.html.

    >>
    >>
    >> Should Netscape 4 be redirected too? It has no more similarity with
    >> Netscape 6+ than IE does.
    >>
    >> <script type="text/javascript">
    >> if (navigator.appName == "Netscape") {
    >> location.href = "index-ns.html";
    >> }
    >> </script>
    >>
    >> If you don't want to include Netscape 4, you can add the condition
    >> parseInt(navigator.appVersion,10)>4
    >>
    >>
    >>> Reply only to group please!

    >>
    >>
    >> Ofcourse. But you should still have a valid reply address, mr. For
    >> Example.
    >>
    >> /L

    >
    >
    >




    --
    Charles Banas
     
    Charles Banas, Aug 25, 2003
    #7
  8. On Sat, 23 Aug 2003 12:44:21 -0400, For Example: John Smith
    <> wrote:

    > Interesting, thanks for the info. But why then do I always hear talk of
    > browser re-direction? It seems like a popular and widely used "trick" on
    > the Internet.
    >

    not any more. i haven't seen a single page use redirection in almost 2
    years. i've seen sites moving more and more toward single-page solutions.
    for example, the Junkyard ( http://the-junkyard.net/ ) puts all of its
    content in a MySQL database. so, having a redirect only introduces more
    headaches.

    it's easier to make all those changes in stylesheets. at tJY, we have
    several stylesheets for our site that users can choose to get the browsing
    experience they want.

    (you might also notice the "Mac" styles. those limit the width of the page
    and nothing more. it's because one of the staffers complained about it
    breaking on his mac.)

    the last time i saw redirection was actually when i was playing with a
    WYSIWYG website editor. i don't recall the name of it, but the company was
    ultimately bought by Macromedia and their technology was used in
    DreamWeaver. whatever the case, it used a LOT of IE-only and NS-only
    tricks to simulate layers because neither really supported it. it was
    quite a mess and ended up requiring a redirect. it wasn't even very
    reliable, as i recall.

    --
    Charles Banas
     
    Charles Banas, Aug 25, 2003
    #8
    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. Jon Landenburer

    redirecting stderr and stdout

    Jon Landenburer, May 12, 2004, in forum: Perl
    Replies:
    1
    Views:
    11,217
    Joe Smith
    May 13, 2004
  2. Sune Hansen

    Site keeps redirecting

    Sune Hansen, Jun 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    375
    Sune Hansen
    Jun 30, 2003
  3. Leslie McGann
    Replies:
    0
    Views:
    2,087
    Leslie McGann
    Jul 3, 2003
  4. El Kabong

    Browsers, browsers! Quo vadis?

    El Kabong, May 11, 2007, in forum: HTML
    Replies:
    23
    Views:
    907
    dorayme
    May 13, 2007
  5. Kenneth Keeley

    Some Browsers not redirecting properly

    Kenneth Keeley, Aug 15, 2004, in forum: ASP General
    Replies:
    10
    Views:
    308
    Kenneth Keeley
    Aug 27, 2004
Loading...

Share This Page