All Projects → srfrnk → Ng Device Detector

srfrnk / Ng Device Detector

Licence: mit
Angular module to detect OS / Browser / Device

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ng Device Detector

uainfer
Infer the user agent from its User Agent string
Stars: ✭ 21 (-91.36%)
Mutual labels:  user-agent, useragent
useragent-generator
Easily generate correct user-agent strings for popular browsers
Stars: ✭ 62 (-74.49%)
Mutual labels:  user-agent, useragent
User agent
HTTP User Agent parser for the Go programming language.
Stars: ✭ 578 (+137.86%)
Mutual labels:  user-agent, useragent
browserslist-generator
A library that makes generating and validating Browserslists a breeze!
Stars: ✭ 77 (-68.31%)
Mutual labels:  user-agent, useragent
bots-zoo
No description or website provided.
Stars: ✭ 59 (-75.72%)
Mutual labels:  user-agent, useragent
Browser.php
A PHP Class to detect a user's Browser. This encapsulation provides a breakdown of the browser and the version of the browser using the browser's user-agent string. This is not a guaranteed solution but provides an overall accurate way to detect what browser a user is using.
Stars: ✭ 546 (+124.69%)
Mutual labels:  user-agent, useragent
React Device Detect
Detect device, and render view according to detected device type.
Stars: ✭ 1,145 (+371.19%)
Mutual labels:  user-agent, useragent
Browscap Java
A blazingly fast and memory efficient (thread-safe) Java client on top of the BrowsCap CSV source files.
Stars: ✭ 123 (-49.38%)
Mutual labels:  useragent
Device Detector
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.
Stars: ✭ 2,106 (+766.67%)
Mutual labels:  user-agent
Http request randomizer
Proxying Python Requests
Stars: ✭ 110 (-54.73%)
Mutual labels:  user-agent
Useragent.js
A User-agent analyze project.
Stars: ✭ 70 (-71.19%)
Mutual labels:  user-agent
Parser Php
Browser sniffing gone too far — A useragent parser library for PHP
Stars: ✭ 1,626 (+569.14%)
Mutual labels:  user-agent
Uap Ruby
A simple, comprehensive Ruby gem for parsing user agent strings with the help of BrowserScope's UA database
Stars: ✭ 188 (-22.63%)
Mutual labels:  useragent
Fetch Plus
🐕 Fetch+ is a convenient Fetch API replacement with first-class middleware support.
Stars: ✭ 116 (-52.26%)
Mutual labels:  user-agent
Random User Agent
😎 Google chrome browser extension
Stars: ✭ 201 (-17.28%)
Mutual labels:  user-agent
Crawler Detect
🕷 CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
Stars: ✭ 1,549 (+537.45%)
Mutual labels:  user-agent
User agent
Generator of User-Agent header
Stars: ✭ 227 (-6.58%)
Mutual labels:  user-agent
Mojo
✨ Mojolicious - Perl real-time web framework
Stars: ✭ 2,298 (+845.68%)
Mutual labels:  user-agent
React Useragent
Integrate user-agent detection in an idiomatic React way
Stars: ✭ 154 (-36.63%)
Mutual labels:  user-agent
Shadow Useragent
Pick the most common user-agents on the Internet 👻
Stars: ✭ 147 (-39.51%)
Mutual labels:  useragent

ng-device-detector

Angular module to detect OS / Browser / Device

Build Status GitHub issues Known Vulnerabilities Open Source Helpers

GitHub license npm npm npm

Commitizen friendly Semver

Uses user-agent to set CSS classes or directly usable via JS. See website: http://srfrnk.github.io/ng-device-detector

Install

NPM

$ npm install ng-device-detector --save

Bower

$ bower install ng-device-detector --save

Browser (Add scripts in HTML)

<script type="text/javascript" src=".../re-tree.js"></script>
<script type="text/javascript" src=".../ua-device-detector.js"></script>
<script type="text/javascript" src=".../ng-device-detector.js"></script>

Adding 'ng.deviceDetector' to your app module dependencies

angular.module('app', ['ng.deviceDetector']);

Injecting DeviceDetector service in controller

angular.module('app').controller('Home', function($scope, deviceDetector){
  // Awesome stuff
});

To add classes, add directive like: <div device-detector>

Setup

You can set custom detectors at the provider object. The

angular.module('app', ["ng.deviceDetector"])
    .config(['deviceDetectorProvider', function(deviceDetectorProvider) {
      deviceDetectorProvider.addCustom("Custom_UA_Entry", {
        and:["\\bCustom_UA_Entry\\b", {
            not:"\\bChrome\\b"
        }]
      });
    }])
    
    .controller('Home', function($scope, deviceDetector) {
      // (true / false)
      $scope.customUAEntry = deviceDetector.custom["Custom_UA_Entry"];
    });

Custom detectors will also be added as CSS classes with 'is-' prefix and encoded into css class name casing.

deviceDetector service

Holds the following properties:

  • raw : object : contains the raw values... for internal use mostly.
  • os : string : name of current OS
  • browser : string : name of current browser
  • device : string : name of current device

Support

At first I added just major browser, OS, device support. With help from mariendries, javierprovecho and crisandretta more support was added. The current list of supported browser, OS, device can be easily viewed in here.

Pull-requests with new stuff will be highly appreciated :)

Example

See plunker

License

MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].