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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer problem with a platform sniffer

    Hi
    I have put on several pages of my website a javascript tocheck if the visitors use Mac or PC platform.
    On some computers (PC, Explorer), this script doesn't work and I cannot figure out why.
    Find below the code:

    function sniffer(CompanyId){
    var isMac = (navigator.appVersion.indexOf("Mac")!=-1) ? true : false;
    if(isMac){
    location.href = 'company_mac_index.asp?companyId='+CompanyId;
    } else {
    location.href = 'company_index.asp?companyId='+CompanyId;
    }
    return true;
    }
    Thanks for your help

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Try using lower case, I presume some browsers may need this

    var isMac = (navigator.appVersion.indexOf("mac")!=-1)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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