{"id":21561471,"url":"https://github.com/phpdude/browser.js","last_synced_at":"2026-01-04T21:01:23.194Z","repository":{"id":17534965,"uuid":"20337480","full_name":"phpdude/browser.js","owner":"phpdude","description":"browser.js - Lightweight Browser \u0026 OS detection library like Modernizr.","archived":false,"fork":false,"pushed_at":"2014-05-30T21:38:56.000Z","size":416,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T11:25:51.609Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://phpdude.github.io/browser.js/","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phpdude.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-30T17:54:09.000Z","updated_at":"2024-09-13T16:51:16.000Z","dependencies_parsed_at":"2022-08-31T14:01:26.710Z","dependency_job_id":null,"html_url":"https://github.com/phpdude/browser.js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdude%2Fbrowser.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdude%2Fbrowser.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdude%2Fbrowser.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpdude%2Fbrowser.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpdude","download_url":"https://codeload.github.com/phpdude/browser.js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244159966,"owners_count":20408017,"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":[],"created_at":"2024-11-24T09:23:05.018Z","updated_at":"2026-01-04T21:01:23.114Z","avatar_url":"https://github.com/phpdude.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# [browser.js](https://github.com/phpdude/browser.js/) v0.1.1\n\nbrowser.js makes it easy to write conditional CSS based on device operating system and web browser.\n\n### Online demo\n\nYou can go to online [demo](http://phpdude.github.io/browser.js/demo/).\n\n### Examples\n\nbrowser.js inserts css classes into `\u003chtml\u003e` element.\n\n### Mac OS \u0026 Firefox\n\n\u003cimg src=\"http://phpdude.github.io/browser.js/screenshots/mac%20os%20firefox.png\" /\u003e\n\n### iPad Emulator \u0026 Safari\n\n\u003cimg src=\"http://phpdude.github.io/browser.js/screenshots/ipad.png\" /\u003e\n\n### Mac OS \u0026 Google Chrome\n\n\u003cimg src=\"http://phpdude.github.io/browser.js/screenshots/mac%20os%20chrome.png\" /\u003e\n\n## Usage\n\nJust include the script. The script then updates the `\u003chtml\u003e` section with the appropriate classes based on os \u0026 browser names detected by [platform.js](https://github.com/bestiejs/platform.js).\n\n``` html\n\u003cscript src=\"lib/browser.min.js\"\u003e\u003c/script\u003e\n```\n\n### Embeded class names\n\nbrowser.js add classes to `\u003chtml\u003e` element by masks\n\n```\nua-#{ua}\nos-#{os}\n#{os}-#{ua}\nua-#{ua}#{version} (Major version number)\n```\n\nExample for Mac OS \u0026 firefox\n\n```\nua-firefox\nos-mac\nmac-firefox\nua-firefox29\n```\n\n### Support no-js/nojs `\u003chtml\u003e` classes.\n\nbrowser.js will remove no-js or nojs classes from `\u003chtml\u003e` element.\n\n### Utilities\n\n#### browser.noConflict()\n\nRun browser.js in noConflict mode, returning the browser variable to its previous owner.\nReturns a reference to the browser object.\n\n#### browser.js JavaScript methods\n\nYou can get browser detected classes by javascript api.\n\n``` html\n\u003cscript\u003e\nconsole.log(browser.classes());\n\u003c/script\u003e\n```\n\nbrowser.js doesn't remove any extra classes added in `\u003chtml\u003e` section.\n\n### Usage\n\nIn your CSS you can use added browser.js classes for making elegant hacks for selected browsers. For example you can make hacks for all IE and IE6.\n\n``` css\n.ua-ie .adv {\n    margin-top: 15px;\n}\n\n.ua-ie6 .adv {\n    margin-top: 17px;\n}\n```\n\n### Contributor\n\nAlexandr Shurigin (aka [phpdude](https://github.com/phpdude/))\n\n### Thanks to\n\n##### [platform.js](https://github.com/bestiejs/platform.js)\n\nplatform.js used for browsers \u0026 OS detection capabilities.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdude%2Fbrowser.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpdude%2Fbrowser.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpdude%2Fbrowser.js/lists"}