Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts

    OS detection script

    Hi everybody,

    I am looking for a script that will detect the user's os system, specifically detect if the user is using a Mac or a PC. Then, according to the os, it will direct them to the appropriate web pages. Anybody knows where I can find such a script? I made a search, and I found scripts that detect the browser only, could not find anything about the os.

    Thanking you i8n advance

    Hrisula

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    10,968
    Thanks
    0
    Thanked 236 Times in 233 Posts
    var os = navigator.platform.toLowerCase();
    var mac = (os.indexOf("mac")!=-1) ? true:false;
    var win = (os.indexOf("win")!=-1) ? true:false;

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you so much Glenn.

    I appreciate your help
    Hrisula

  • #4
    New Coder
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    One other quick question... just to make sure I get it correctly.

    Am I to understand that I name my files, in this example mac.htm and win.htm ?
    And I make these modifications to the script
    (os.indexOf("mac.htm")
    (os.indexOf("win.htm")

    Thanks again

  • #5
    New Coder
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PLease, somebody...

    I just can't make it work, the mechanism escapes me
    Can you give me some clues?

    Presently I have an index file (index.htm) which is the same for all. Then users will have to be channeled to the appropriate Mac or PC pages (say mac.htm & win.htm. How will that happen

    Have I got it all wrong???

  • #6
    New Coder
    Join Date
    Jun 2002
    Location
    Montreal
    Posts
    80
    Thanks
    0
    Thanked 0 Times in 0 Posts
    IT's OK now, I managed
    Thanks anyway


  •  

    Posting Permissions

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