Useragent 的详细信息不详,或者我没有在正确的地方查找。
就 navigator.userAgent.match()
而言,iOS7、iPad 或 iPhone 上的 Chrome 和 Safari 有什么区别?
最佳答案
var ua = navigator.userAgent;
var matches = ua.match(/^.*(iPhone|iPad).*(OS\s[0-9]).*(CriOS|Version)\/[.0-9]*\sMobile.*$/i);
if (!matches) console.log("Not what we're looking for.");
else {
console.log(matches[1]);
if (matches[2] === 'OS 7') console.log(matches[2]);
else console.log('Not the right version.');
if (matches[3] === 'CriOS') console.log("Chrome");
else console.log("Safari");
}
引用:https://developers.google.com/chrome/mobile/docs/user-agent
关于javascript - 如何区分 iOS7 用户代理字符串中的 Chrome 和 Safari?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19106645/