Web Analytics Made Easy -
StatCounter problem with a platform sniffer - CodingForum

Announcement

Collapse
No announcement yet.

problem with a platform sniffer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Try using lower case, I presume some browsers may need this

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

    Comment

    Working...
    X