SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2004
    0 Post(s)
    0 Thread(s)

    javascript--browser sniff (sorry duplicate post-tried to delete)

    Making a website, I found out it looks different on different machines, Mac, and PC, and then on different versions of browsers.
    This led to trying to find a solution to this, as the page was written with no technical expertise at all, just hit and miss, starting from a web page example, as I am no programmer.

    After much help, and input, it was rewritten in CSS, by a kind person in these forums, and thru pm's, and other threads, some of which I didin't really understand, it seems a good course for me to follow would be to have the site in CSS for older browsers, as it renders ok in Netscape 7.1 Mac, and PC, IE 5.2 Mac, and IE 5.5 PC, and Firefox 0.8,

    So, again in these forums (they're great!),, lets you see your page on different versions of browsers, etc., and Iwill be using free trial, so after seeing where it's messed up, I need a javascript that will
    tell me the browser someone is using so that they can view the regular, or CSS version of the page.

    I tried looking it up, and found this

    <script type="text/javascript">
    document.write("<p>Browser: ")
    document.write(navigator.appName + "</p>")

    document.write("<p>Browserversion: ")
    document.write(navigator.appVersion + "</p>")

    But realised this really didn't tell me what browser they were using--

    That would be found out by:

    document.write("UA=" + x.userAgent)
    document.write("<br />")
    But was part of a string, and then I'm lost, and I understand these only basically..

    --Would someone please give me a script that would tell what browser version someone was using and how to direct them to one of two pages?

    Thanks for all the help--these forums are GREAT!
    Last edited by Bob M; Jul 7, 2004 at 23:24. Reason: duplicate post--looked up how, and tried to delete, but couldnt-sorry!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts