iOS Chrome检测 [英] iOS Chrome detection
本文介绍了iOS Chrome检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用于移动设备检测,但未检测到iOS版Chrome。有没有办法检测到它?
谢谢。根据 代理> Google开发人员,UA字符串如下所示:
Mozilla / 5.0(iPhone; U; CPU iPhone OS 5_1_1像Mac OS X; en)AppleWebKit / 534.46.0(KHTML,如Gecko)CriOS / 19.0.1084.60 Mobile / 9B206 Safari / 7534.48.3
它与iOS Safari不同之处在于它表示 CriOS
而不是版本
。所以这:
if(navigator.userAgent.match('CriOS'))
应该这样做。
I use Javascript code
if( (Android|webOS|iPhone|iPad|iPod|BlackBerry).test(navigator.userAgent) ) {}
for mobile device detection, but Chrome at iOS is not detected. Is there a way to detect it? Thanks.
解决方案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
Where it differs from iOS Safari in that it says
CriOS
instead ofVersion
. So this:if(navigator.userAgent.match('CriOS'))
Should do it.
这篇关于iOS Chrome检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文