
For more information about how version comparisons are performed, please see the is() function of the Version object. The third is an integer, float or string that contains the version. The second arguments is a string that can container either or >.

The first argument always contains the name of the browser. The funcion can contain a single argument to a simple comparison based on name, or three arguments to compare both name and version. Is used to query the name and version property of the browser object.
#Javascript multibrowser lowerstring portable#
Return true if the browser is a mobile device, like a phone, tablet, ereader, camera, portable media player, watch or portable gaming console. If none of the arguments matches, it returns false It can use multiple arguments in which case the function returns true if one of the arguments matches. The argument can optionally also provide a subtype by concatenating it to the type and seperating it with a semicolon. If a single argument is used, the function returns true if the argument matches the type propery of device object. If the subtype is not applicable, it just return the type, for example: desktop or ereader.

If a subtype is present it is concatenated to the type and seperated by a semicolor, for example: mobile:smart or gaming:portable. Returns the type and subtype property of the device object. All of these properties are guaranteed to be present.Īn object that contains information about the browser itselfĪn object that contains information about the rendering engineĪn object that contains information about the operating systemĪn object that contains information about the device API reference The WhichBrowser objectĪfter a new WhichBrowser object is created, it contains a number of properties and functions. For example setting cacheExpiries to 0 will prevent ALL results to expire because it will disable the cache validity check (for the sake of truth it will be done every 57085 years, 5 months, 10 days, 7 hours, 35 minutes and 48 seconds). In this way the cache lasts for 300 seconds but is checked every 1 second.īe aware that changing cacheExpiries or cacheCheckInterval impact the cache validity check rate for ALL records in the cache. For example:Ĭonst result = new WhichBrowser ( request. It gives you names and versions and even device manufacturer and model. You get a nice object which has information about the browser, rendering engine, os and device. Even Internet Explorer 11 now no longer claims to be IE at all, but instead an unnamed browser that is like Gecko. Almost all browsers say they are Netscape 5 and almost all WebKit browsers say they are based on Gecko. Seriously, there is not a single browser that is completely truthful. And to do that you need a browser sniffing library.īecause everybody lies. The original author website is and he wanted to know which score belongs to which browser. There are valid reasons to do browser sniffing: to improve the user experience or to gather intelligence about which browsers are used on your website. Well, there is always an exception to the rule. If you are looking for the server written in PHP that provides a Javascript API for the browser, please go to the WhichBrowser/Server project.īut why almost completely useless and not completely useless?

If you are looking for the PHP version of WhichBrowser, please go to the WhichBrowser/Parser-PHP project. So stop right now and go read something about feature detecting instead. Useless because you shouldn't use browser sniffing. This is an extremely complicated and almost completely useless browser sniffing library written in JavaScript.
