This front-end module provides an AngularJS Service which you can use to detect browsers and OS.
You can use CleverStack CLI for easy install.
Run the following command:
clever install clever-browserdetect
-
Add 'cs_browserdetect' to your app/modules/main.js file. It belongs in the
package
array at the top. -
Add
cs_browserdetect
to your app/modules/application/main.js file. It belongs in the array of required modules. -
Add
cs_browserdetect
to your app/modules/application/module.js file.cs_browserdetect
belongs in yourapp
module's array of required modules.
Include the service $CSBrowserDetectService
into a controller and you can reference the following properties.
$CSBrowserDetectService.browser
// Chrome Safari, Firefox, MSIE, Opera...
$CSBrowserDetectService.version
// ie - 24, 28, 4.2...
$CSBrowserDetectService.OS
// Windows, Mac, Linux, iPhone...
It sets up a view with a route you can test if you go to http://localhost/browserdetect
.