Professional Web Applications Themes

HTML code for checking browser and platform version - Macromedia Dreamweaver

I'm trying to create some sniffer code for a site and I need to be able to check both the visitors browser version and their platform (PC or Mac) and redirect based on a combination of results. Here's some examples: If the visitor is on a PC using IE 5.x or higher they would be redirected to "page1.htm" If the visitor is on a PC using Netscape 4.5 or higher they would be redirected to "page2.htm" If the visitor is on a Mac using IE 5.x or higher they would be redirected to "page3.htm" Dreamweaver already has the "Check Browser" ...

  1. #1

    Default HTML code for checking browser and platform version

    I'm trying to create some sniffer code for a site and I need to be able to check both the visitors browser version and their platform (PC or Mac) and redirect based on a combination of results. Here's some examples:

    If the visitor is on a PC using IE 5.x or higher they would be redirected to "page1.htm"
    If the visitor is on a PC using Netscape 4.5 or higher they would be redirected to "page2.htm"
    If the visitor is on a Mac using IE 5.x or higher they would be redirected to "page3.htm"

    Dreamweaver already has the "Check Browser" behavior and I'm using that but I need to add the code for checking for the plaform. Does anyone have any sample code they can share?


    Thanks,

    Bill Perry | [url]www.pocketpcflash.net[/url]
    Team Macromedia Volunteer for Flash
    ----
    Bill Perry Guest

  2. #2

    Default Re: HTML code for checking browser and platform version

    Bill Perry wrote:
    ::
    :: If the visitor is on a PC using IE 5.x or higher they would be
    :: redirected to "page1.htm" If the visitor is on a PC using Netscape
    :: 4.5 or higher they would be redirected to "page2.htm" If the visitor
    :: is on a Mac using IE 5.x or higher they would be redirected to
    :: "page3.htm"
    ::
    :: Dreamweaver already has the "Check Browser" behavior and I'm using
    :: that but I need to add the code for checking for the plaform. Does
    :: anyone have any sample code they can share?

    navigator.platform exposes the operating system. You could try something
    like this:

    if (navigator.platform.indexOf("Win") != -1) {var isWin = true;}
    if (navigator.platform.indexOf("Mac") != -1) {var isMac = true;}

    Then combine it with your existing script, for example:

    if (isMac && isIE5) {
    //do this
    }

    Generally speaking, though, the idea of having to create different pages for
    different operating systems and browsers is very inefficient. It's better to
    try to create cross-browser and cross-platform pages. But it's your call.

    --
    David Powers
    *******************************************
    No-nonsense reviews of computer books
    [url]http://japan-interface.co.uk/webdesign/books.html[/url]
    Save 10% on TopStyle CSS Editor
    *******************************************


    David Powers Guest

Similar Threads

  1. #40707 [NEW]: checking for db4 major version... Header contains different version
    By BLentz at channing-bete dot com in forum PHP Bugs
    Replies: 3
    Last Post: March 3rd, 08:13 PM
  2. #40406 [NEW]: Hangs and checking for flex version
    By david dot marek at mattel dot com in forum PHP Bugs
    Replies: 1
    Last Post: February 8th, 07:27 PM
  3. checking whether browser allows cookies in asp.net
    By Ollie in forum ASP.NET Security
    Replies: 3
    Last Post: July 24th, 09:33 PM
  4. Checking which version of Jet a database is using
    By Mystery in forum ASP Database
    Replies: 2
    Last Post: December 12th, 09:38 PM
  5. FH version & cross-platform differences
    By ccarnesware webforumsuser@macromedia.com in forum Macromedia Freehand
    Replies: 0
    Last Post: September 17th, 12:31 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139