iOS Chrome 检测 [英] iOS Chrome detection

查看:26
本文介绍了iOS Chrome 检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Javascript 代码

I use Javascript code

if( (Android|webOS|iPhone|iPad|iPod|BlackBerry).test(navigator.userAgent) ) {}

用于移动设备检测,但未检测到 iOS 上的 Chrome.有没有办法检测它?谢谢.

for mobile device detection, but Chrome at iOS is not detected. Is there a way to detect it? Thanks.

推荐答案

根据 Google Developers,UA 字符串如下所示:

According to Google Developers, the UA string looks like this:

Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3

它与 iOS Safari 的不同之处在于它显示 CriOS 而不是 Version.所以这个:

Where it differs from iOS Safari in that it says CriOS instead of Version. So this:

if(navigator.userAgent.match('CriOS'))

应该这样做.

这篇关于iOS Chrome 检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆