The lists below are auto generated and updated from time to time. What device-detector-js is able to detect You may experience inconsistencies when running this library in a browser environment, as some browsers like Safari do not yet support lookbehind syntax. Keep in mind that using this library in browser-side code means sending around 432 KB of Regex rules and 144 KB of javascript (uncompressed and unminified), which may result in a poor user experience for people with a slow Internet connection. Type definitions are included in this library and exposed via: import from "device-detector-js" Įven though this library can run in the browser, it is strongly advised against doing so, unless you are not concerned with performance. Defaults to 1, only minor versions will be returned (e.g. versionTruncation Passing null disables version truncation, so full versions will be returned. skipBotDetection If true, bot detection will completely be skipped (bots will be detected as regular devices).options Options object which might have the following properties:.TypeScript import: import DeviceDetector = require("device-detector-js") Įxample - user agent detection: import DeviceDetector from "device-detector-js" Ĭonst deviceDetector = new DeviceDetector() Ĭonst userAgent = "Mozilla/5.0 (Macintosh Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/.81 Safari/537.36" Ĭonst device = deviceDetector.parse(userAgent) Įxample - bot detection: import BotDetector from "device-detector-js/dist/parsers/bot" Ĭonst userAgent = "Mozilla/5.0 (iPhone CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25 (compatible Googlebot-Mobile/2.1 +)" Ĭonst bot = botDetector.parse(userAgent) ĪPI Documentation new DeviceDetector() Usage ES2015 import: import DeviceDetector from "device-detector-js" To use device-detector-js in your project, run: npm install device-detector-js This is a javascript port of Matomo device-detector (4.2.3). This library is heavily tested and relies on over 10,000 tests to detect thousands of user agent strings, even from rare and obscure browsers and devices. Device-detector-js is a precise user agent parser and device detector written in TypeScript, backed by the largest and most up-to-date open-source user agent database.ĭevice-detector-js will parse any user agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |