简体   繁体   中英

Tell if browser is chrome running on windows or mac/linux

Is there an easy way to tell if chrome is under windows or mac/linux?

I have a webbapplication where the browser behaves different when running it on MAC and PC.

Try this

function testOS(){

 var mac=navigator.userAgent.match(/(Mac)/i)?true:false;
 if($.browser.webkit){
   if(mac){
          //Mac Code
   }
   else{
         //window code
   }
 }
}

Yes there is. Hope the below code will help.

if (navigator.appVersion.indexOf("Win")!=-1){
     //It is Windows
}else if(navigator.appVersion.indexOf("Linux")!=-1){
     //It is Linux
}else if((navigator.appVersion.indexOf("Mac")!=-1){
     //It is Mac
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM