简体   繁体   English

判断浏览器是否在windows或mac / linux上运行chrome

[英]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? 有没有一种简单的方法来判断chrome是在windows还是mac / linux下?

I have a webbapplication where the browser behaves different when running it on MAC and PC. 我有一个webbapplication,浏览器在MAC和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
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我可以判断我的Chrome扩展程序是否在Windows上运行吗? - Can I tell if my Chrome Extension is running on Windows? 从浏览器获取mac地址,包括chrome、windows、safari、firefox - obtain mac address from browser including chrome, windows, safari, firefox 如何在Linux / Mac / Windows上的节点/电子应用程序中获取浏览器活动标签URL? - How to get browser active tab URL in node/electron app on Linux/Mac/Windows? javascript of a site works on android, windows, linux and on all browsers but not in mac, ios on any browser - javascript of a site works on android, windows, linux and on all browsers but not in mac, ios on any browser 告诉浏览器中正在运行哪些脚本的程序? - Program to tell what scripts are running in a browser? 仅将CSS应用于Linux chrome,而不应用于Windows chrome - Apply css only for linux chrome but not for windows chrome 如何仅将Chrome浏览器定位为Mac? - How to target the chrome browser for Mac only? 在 Windows、Mac 和 Linux 上分发 Electron 应用程序 - Distributing an Electron app on Windows, Mac and Linux 我能告诉我哪些浏览器镶边元素在Firefox中可见吗? - Can I tell what browser-chrome elements are visible in Firefox? 如何通过浏览器检测告诉用户在Chrome中打开页面 - How to tell user to open page in Chrome with Browser Detect
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM