[IMP] web: add the detection of iPadOS
Before this commit, the iPad with iPadOS was not detected as 'isMobileDevice'. Now the detection is more accurate.
This commit is contained in:
@@ -14,6 +14,11 @@ const bus = new Bus();
|
||||
* this file someday.
|
||||
*/
|
||||
|
||||
const maxTouchPoints = navigator.maxTouchPoints || 1;
|
||||
const isAndroid = /Android/i.test(navigator.userAgent);
|
||||
const isIOS = /(iPad|iPhone|iPod)/i.test(navigator.userAgent) || (navigator.platform === 'MacIntel' && maxTouchPoints > 1);
|
||||
const isOtherMobileDevice = /(webOS|BlackBerry|Windows Phone)/i.test(navigator.userAgent);
|
||||
|
||||
var config = {
|
||||
device: {
|
||||
/**
|
||||
@@ -52,13 +57,7 @@ var config = {
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
isMobileDevice: navigator.userAgent.match(/Android/i) ||
|
||||
navigator.userAgent.match(/webOS/i) ||
|
||||
navigator.userAgent.match(/iPhone/i) ||
|
||||
navigator.userAgent.match(/iPad/i) ||
|
||||
navigator.userAgent.match(/iPod/i) ||
|
||||
navigator.userAgent.match(/BlackBerry/i) ||
|
||||
navigator.userAgent.match(/Windows Phone/i),
|
||||
isMobileDevice: isAndroid || isIOS || isOtherMobileDevice,
|
||||
/**
|
||||
* Mapping between the numbers 0,1,2,3,4,5,6 and some descriptions
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user