Redirecting Browsers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • For Example: John Smith

    #1

    Redirecting Browsers

    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!


  • Lasse Reichstein Nielsen

    #2
    Re: Redirecting Browsers

    For Example: John Smith <none@host.inva lid> writes:
    [color=blue]
    > 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?[/color]

    As an Opera user, I recommend against being that specific.
    [color=blue]
    > 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.[/color]

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

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

    If you don't want to include Netscape 4, you can add the condition
    parseInt(naviga tor.appVersion, 10)>4
    [color=blue]
    > Reply only to group please![/color]

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

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Jim Dabell

      #3
      Re: Redirecting Browsers

      For Example: John Smith wrote:
      [color=blue]
      > 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.[/color]

      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.

      [color=blue]
      > How do I redirect visitors to different pages based on their
      > browser?[/color]

      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.

      [color=blue]
      > 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?[/color]

      Redesign HTTP to make an accurate User-Agent header mandatory, alter all
      existing user-agents, and get everyone in the world to upgrade.


      --
      Jim Dabell

      Comment

      • For Example: John Smith

        #4
        Re: Redirecting Browsers

        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:
        [color=blue]
        > For Example: John Smith wrote:
        >
        >[color=green]
        >>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.[/color]
        >
        >
        > 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.
        >
        >
        >[color=green]
        >>How do I redirect visitors to different pages based on their
        >>browser?[/color]
        >
        >
        > 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.
        >
        >
        >[color=green]
        >>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?[/color]
        >
        >
        > Redesign HTTP to make an accurate User-Agent header mandatory, alter all
        > existing user-agents, and get everyone in the world to upgrade.
        >
        >[/color]


        Comment

        • For Example: John Smith

          #5
          Re: Redirecting Browsers

          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:
          [color=blue]
          > For Example: John Smith <none@host.inva lid> writes:
          >
          >[color=green]
          >>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?[/color]
          >
          >
          > As an Opera user, I recommend against being that specific.
          >
          >[color=green]
          >>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.[/color]
          >
          >
          > Should Netscape 4 be redirected too? It has no more similarity with
          > Netscape 6+ than IE does.
          >
          > <script type="text/javascript">
          > if (navigator.appN ame == "Netscape") {
          > location.href = "index-ns.html";
          > }
          > </script>
          >
          > If you don't want to include Netscape 4, you can add the condition
          > parseInt(naviga tor.appVersion, 10)>4
          >
          >[color=green]
          >>Reply only to group please![/color]
          >
          >
          > Ofcourse. But you should still have a valid reply address, mr.
          > For Example.
          >
          > /L[/color]


          Comment

          • David Dorward

            #6
            Re: Redirecting Browsers

            Please direct your attention towards:


            For Example: John Smith wrote:
            [color=blue]
            > I'm not familiar with Opera?[/color]

            Faster, safer and smarter than default browsers. Fully-featured for privacy, security, and so much more. Get the faster, better Opera browser for free.

            [color=blue]
            > I thought most people used IE now (like 97% according to the last survey I
            > read).[/color]

            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/

            Comment

            • Lasse Reichstein Nielsen

              #7
              Re: Redirecting Browsers

              For Example: John Smith <none@host.inva lid> writes:
              [color=blue]
              > 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.[/color]

              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.
              [color=blue]
              > So I want people using Netscape (which Mozilla is derived from)[/color]

              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 - lrn@hotpop.com
              Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
              'Faith without judgement merely degrades the spirit divine.'

              Comment

              • HikksNotAtHome

                #8
                Re: Redirecting Browsers

                In article <7k54i1hf.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
                writes:
                [color=blue]
                >For Example: John Smith <none@host.inva lid> writes:
                >[color=green]
                >> 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.[/color]
                >
                >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 :).[/color]

                I am not a Java person, so my opinions have to be taken with a huge grain of
                salt. But it seems that if JAVA was developed by Sun, and the Java applet has
                trouble with Suns JVM, then the fault lies not within Suns JVM but the applet.
                And that the MS JVM is doing the same as the IE browser and letting snafus get
                through. Or is my reasoning flawed?
                --
                Randy
                All code posted is dependent upon the viewing browser
                supporting the methods called, and Javascript being enabled.

                Comment

                • Charles Banas

                  #9
                  Re: Redirecting Browsers

                  On Sat, 23 Aug 2003 14:27:25 -0400, For Example: John Smith
                  <none@host.inva lid> wrote:
                  [color=blue]
                  > 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.
                  >[/color]
                  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
                  [color=blue]
                  > Lasse Reichstein Nielsen wrote:
                  >[color=green]
                  >> For Example: John Smith <none@host.inva lid> writes:
                  >>
                  >>[color=darkred]
                  >>> 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?[/color]
                  >>
                  >>
                  >> As an Opera user, I recommend against being that specific.
                  >>
                  >>[color=darkred]
                  >>> 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.[/color]
                  >>
                  >>
                  >> Should Netscape 4 be redirected too? It has no more similarity with
                  >> Netscape 6+ than IE does.
                  >>
                  >> <script type="text/javascript">
                  >> if (navigator.appN ame == "Netscape") {
                  >> location.href = "index-ns.html";
                  >> }
                  >> </script>
                  >>
                  >> If you don't want to include Netscape 4, you can add the condition
                  >> parseInt(naviga tor.appVersion, 10)>4
                  >>
                  >>[color=darkred]
                  >>> Reply only to group please![/color]
                  >>
                  >>
                  >> Ofcourse. But you should still have a valid reply address, mr. For
                  >> Example.
                  >>
                  >> /L[/color]
                  >
                  >
                  >[/color]



                  --
                  Charles Banas

                  Comment

                  • Charles Banas

                    #10
                    Re: Redirecting Browsers

                    On Sat, 23 Aug 2003 12:44:21 -0400, For Example: John Smith
                    <none@host.inva lid> wrote:
                    [color=blue]
                    > 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.
                    >[/color]
                    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

                    Comment

                    Working...