{"id":21813206,"url":"https://github.com/webdevstudios/wds-browser-detect","last_synced_at":"2025-07-15T20:44:52.412Z","repository":{"id":32717533,"uuid":"36307249","full_name":"WebDevStudios/WDS-Browser-Detect","owner":"WebDevStudios","description":"A lightweight plugin to detect browsers, operating systems, and devices.","archived":false,"fork":false,"pushed_at":"2015-08-06T14:14:31.000Z","size":164,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-27T13:45:12.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/WebDevStudios.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-26T16:00:18.000Z","updated_at":"2020-08-18T00:25:45.000Z","dependencies_parsed_at":"2022-09-11T10:01:11.753Z","dependency_job_id":null,"html_url":"https://github.com/WebDevStudios/WDS-Browser-Detect","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDevStudios%2FWDS-Browser-Detect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDevStudios%2FWDS-Browser-Detect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDevStudios%2FWDS-Browser-Detect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebDevStudios%2FWDS-Browser-Detect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebDevStudios","download_url":"https://codeload.github.com/WebDevStudios/WDS-Browser-Detect/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795463,"owners_count":21162776,"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-27T14:27:54.763Z","updated_at":"2025-04-13T23:26:23.856Z","avatar_url":"https://github.com/WebDevStudios.png","language":"PHP","readme":"##WDS Browser Detect\nA lightweight plugin to detect browsers, operating systems, and devices.\n\nPowered by a (slightly) modified version of Chris Schuld's [https://github.com/cbschuld/Browser.php](https://github.com/cbschuld/Browser.php)\n\n## Installation\n* Download, unzip, and place into you WordPress `/plugins/` directory.\n* Activate via the WordPress plugin manager.\n\n## Caveats\nThis PHP script uses server-side User Agent sniffing - which isn't always reliable. If you're trying to detect browser capabilities, use [http://modernizr.com/](Modernizer) instead.\n\nAlso, If you're running any kind of page caching, this plugin will not work correctly. The first person to hit your site might be on a mobile device, and then cache will be generated (based on a mobile device). The next visitor my be using a desktop browser - and see something very different!\n\n## Changelog\n\n* 1.1 - Add support for Microsoft Edge \u0026 Windows 10\n* 1.0 - Initial release\n\n## Available Functions\n\nBrowsers\n\n```php\nwds_browser_is_ie()\n```\n\n```php\nwds_browser_is_edge()\n```\n\n```php\nwds_browser_is_chrome()\n```\n\n```php\nwds_browser_is_safari()\n```\n\n```php\nwds_browser_is_firefox()\n```\n\n```php\nwds_browser_is_facebook()\n```\n\n```php\nwds_browser_is_aol()\n```\n\nDevices\n\n```php\nwds_browser_is_mobile()\n```\n\n```php\nwds_browser_is_tablet()\n```\n\n```php\nwds_browser_is_handheld()\n```\n\n```php\nwds_browser_is_robot()\n```\n\nOperating Systems\n\n```php\nwds_browser_is_windows()\n```\n\n```php\nwds_browser_is_osx()\n```\n\n```php\nwds_browser_is_linux()\n```\n\n```php\nwds_browser_is_ios()\n```\n\n```php\nwds_browser_is_anroid()\n```\n\n## Example Usage\n\nThese helper functions are intended to be used in conditionals and returns a BOOLEAN either `TRUE` or `FALSE`. Basic usage looks like:\n\n```php\nif ( wds_browser_is_ie() ) {\n\techo 'The browser is IE';\n}\n```\nYou can even detect browser versions for Chrome, Safari, Firefox, and IE:\n\n```php\nif ( wds_browser_is_ie( '9' ) ) {\n\techo 'The browser is IE 9';\n}\n```\nHow about detecting if the browser is mobile?\n\n```php\nif ( wds_browser_is_mobile() ) {\n\techo 'The browser is mobile';\n}\n```\n...Or a tablet?\n\n```php\nif ( wds_browser_is_tablet() ) {\n\techo 'The browser is a tablet';\n}\n```\n...Why not both?\n\n```php\nif ( wds_browser_is_handheld() ) {\n\techo 'The browser is a handheld device';\n}\n```\n\n**A real world usage example:**\n\n```php\n/**\n * Adds custom classes to the array of body classes.\n *\n * @param array $classes Classes for the body element.\n * @return array\n */\nfunction wds_client_body_classes( $classes ) {\n\n\tif ( wds_browser_is_ie() ) {\n\t\t$classes[] = 'ie';\n\t}\n\n\tif ( wds_browser_is_ie( '9' ) ) {\n\t\t$classes[] = 'ie9';\n\t}\n\n\tif ( wds_browser_is_mobile() ) {\n\t\t$classes[] = 'phone';\n\t}\n\n\tif ( wds_browser_is_tablet() ) {\n\t\t$classes[] = 'tablet';\n\t}\n\n\treturn $classes;\n}\nadd_filter( 'body_class', 'wds_client_body_classes' );\n```\nFor more examples, checkout the [source code](https://github.com/WebDevStudios/WDS-Browser-Detect/blob/master/wds-browser-detect.php)!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdevstudios%2Fwds-browser-detect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebdevstudios%2Fwds-browser-detect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebdevstudios%2Fwds-browser-detect/lists"}