I'm curious what /i
is in:
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());
}};
}
Source: https://www.sitepoint.com/navigator-useragent-mobiles-including-ipad/
Could anyone tell me what /i
is exactly? I've searched a lot of websites for things about the navigator.userAgent.Match but none explain what /i
is, sometimes it also is /g
/heregoesregex/flags
is literal for Regular Expression in many languages (including javascript). After the last slash you can specify flags for regular expression. List of available flags for javascript includes: