Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  1] [ 1]  / answers: 1 / hits: 45107  / 12 Years ago, mon, december 10, 2012, 12:00:00

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.


More From » ios

 Answers
6

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 of Version. So this:



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


Should do it.


[#81501] Saturday, December 8, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
efrainjamiry

Total Points: 234
Total Questions: 110
Total Answers: 112

Location: French Southern and Antarctic Lands
Member since Fri, Jan 6, 2023
1 Year ago
;