Detecting a mobile browser

Using Regex (from detectmobilebrowsers.com): Here’s a function that uses an insanely long and comprehensive regex which returns a true or false value depending on whether or not the user is browsing with a mobile. For those wishing to include tablets in this test (though arguably, you shouldn’t), you can use the following function: Using navigator.userAgentData … Read more

JavaScript isset() equivalent

I generally use the typeof operator: It will return “undefined” either if the property doesn’t exist or its value is undefined. (See also: Difference between undefined and not being defined.) There are other ways to figure out if a property exists on an object, like the hasOwnProperty method: And the in operator: The difference between … Read more