0
我很好奇/i
是:是什麼/我在navigator.userAgent.match
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}};
}
來源:https://www.sitepoint.com/navigator-useragent-mobiles-including-ipad/
誰能告訴我是什麼/i
是什麼呢?我搜索了很多有關navigator.userAgent.Match東西的網站,但沒有解釋什麼/i
是,有時它也是/g
不區分大小寫標誌的當前 位置。所以模式匹配* Android *,* androiD *,或* anDrOid *等 –
所以/我的意思是說它對大寫和小寫不敏感,但是我可以用其他字符替換/ i嗎? – Gerwin
不,你不能。這就是設計。 –