{"id":15628073,"url":"https://github.com/sibiraj-s/browser-dtector","last_synced_at":"2025-04-15T21:25:11.381Z","repository":{"id":34048241,"uuid":"275290262","full_name":"sibiraj-s/browser-dtector","owner":"sibiraj-s","description":"🌐 A Javascript library to detect browser, version and platform","archived":false,"fork":false,"pushed_at":"2025-04-09T19:18:41.000Z","size":4975,"stargazers_count":31,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T20:27:31.865Z","etag":null,"topics":["browser-detector","useragent-parser"],"latest_commit_sha":null,"homepage":"https://sibiraj-s.github.io/browser-dtector/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":"Unmaintained","scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sibiraj-s.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-27T03:11:28.000Z","updated_at":"2025-04-09T19:18:43.000Z","dependencies_parsed_at":"2023-10-11T06:34:16.060Z","dependency_job_id":"9e45901e-9b30-480d-b3a2-c442b3c73e3f","html_url":"https://github.com/sibiraj-s/browser-dtector","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fbrowser-dtector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fbrowser-dtector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fbrowser-dtector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sibiraj-s%2Fbrowser-dtector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sibiraj-s","download_url":"https://codeload.github.com/sibiraj-s/browser-dtector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249155651,"owners_count":21221639,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["browser-detector","useragent-parser"],"created_at":"2024-10-03T10:20:45.105Z","updated_at":"2025-04-15T21:25:11.357Z","avatar_url":"https://github.com/sibiraj-s.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# browser-dtector [![Tests](https://github.com/sibiraj-s/browser-dtector/workflows/Tests/badge.svg)](https://github.com/sibiraj-s/browser-dtector/actions)\n\n\u003e A Javascript library to detect browser, version and platform\n\n## Getting Started\n\n### Installation\n\nInstall via Package managers such as [npm][npm] or [yarn][yarn]\n\n```bash\nnpm install browser-dtector --save\n# or\nyarn add browser-dtector\n```\n\nor use cdn\n\n```bash\n//cdn.jsdelivr.net/npm/browser-dtector@latest/dist/browser-dtector.js\n```\n\n### Usage\n\nThis library exports both ESM and CJS formats, you should be able to use it in both `Node.js` and `browser`.\n\n```js\nimport BrowserDetector from 'browser-dtector';\n\nconst browser = new BrowserDetector(window.navigator.userAgent);\nbrowser.parseUserAgent();\n```\n\n**Usage in Node.js:**\n\n\u003e [!IMPORTANT]\n\u003e While using in nodejs, it is mandatory to input `useragent`.\n\n```js\nconst http = require('http');\nconst { BrowserDetector } = require('browser-dtector');\n\nconst browser = new BrowserDetector();\n\nhttp\n  .createServer((req, res) =\u003e {\n    // get user-agent header\n    const ua = browser.parseUserAgent(req.headers['user-agent']);\n    // write the result as response\n    res.end(JSON.stringify(ua, null, 4));\n  })\n  .listen(8080, '127.0.0.1');\n\nconsole.log('Server running at http://127.0.0.1:8080/');\n```\n\n**Usage in HTML:**\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n  \u003chead\u003e\n    \u003cmeta charset=\"UTF-8\" /\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" /\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\" /\u003e\n    \u003ctitle\u003eBrowserDetector\u003c/title\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    Hello World!\n    \u003cscript type=\"module\"\u003e\n      import BrowserDetector from 'https://cdn.jsdelivr.net/npm/browser-dtector/dist/browser-dtector.js';\n\n      const detector = new BrowserDetector(window.navigator.userAgent);\n      console.log(detector.parseUserAgent());\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Supported Browsers\n\n- Google Chrome\n- Mozilla Firefox\n- Microsoft Edge\n- Safari\n- Brave\n- Microsoft Internet Explorer\n- Opera\n- Samsung Browser\n- Electron\n\n### Supported Platforms\n\n- Macintosh\n- Microsoft Windows\n- Linux\n- Windows Phone\n- Android\n- Android Tablet\n- IPad\n- IPhone\n- Chrome OS\n- Microsoft Xbox\n\n### Demo\n\n- Browser Detector: \u003chttps://sibiraj-s.github.io/browser-dtector/#/\u003e\n- UserAgent Parser: \u003chttps://sibiraj-s.github.io/browser-dtector/#/ua-parser/\u003e\n\n### API\n\nSample\n\n```js\nimport BrowserDetector from 'browser-dtector';\n\nconst browser = new BrowserDetector(window.navigator.userAgent);\nbrowser.parseUserAgent();\n```\n\n- **parseUserAgent()** [`object`]: Returns parsed useragent info\n\n  ```json\n  {\n    \"name\": \"Google Chrome\",\n    \"platform\": \"Macintosh\",\n    \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) ...\",\n    \"version\": \"71.0.3578.98\",\n    \"shortVersion\": \"71\",\n    \"isAndroid\": false,\n    \"isTablet\": false,\n    \"isMobile\": false,\n    \"isDesktop\": true,\n    \"isWebkit\": true,\n    \"isIE\": false\n  }\n  ```\n\n- **getBrowserInfo()** [`object`]: Returns a minimal and necessary browser info.\n\n  ```json\n  {\n    \"name\": \"Google Chrome\",\n    \"platform\": \"Macintosh\",\n    \"userAgent\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) ...\",\n    \"version\": \"71.0.3578.98\",\n    \"shortVersion\": \"71\"\n  }\n  ```\n\n- **userAgent** [`string | null`]: Useragent for current instance\n\n**Miscellaneous:**\n\n- **BrowserDetector.VERSION** [`string`]: Current version of the library.\n\n[npm]: https://www.npmjs.com/\n[yarn]: https://yarnpkg.com/lang/en/\n[umd]: https://github.com/umdjs/umd\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fbrowser-dtector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsibiraj-s%2Fbrowser-dtector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsibiraj-s%2Fbrowser-dtector/lists"}