Socket
Socket
Sign inDemoInstall

low-browser

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    low-browser

Low Browser it is a small tool to definition Microsoft browsers (IE and EDGE) on JavaScript


Version published
Maintainers
1
Install size
12.2 kB
Created

Readme

Source

Low Browser

GitHub version npm version Bower version Build Status Coverage Status

Low Browser it is a small tool to definition Microsoft browsers (IE and EDGE) on JavaScript

Why?

Sometimes need to define only browsers from Microsoft. Other tools on JavaScript is bloated and slower. Because they seek to support most browsers.

Features

  • Pure, small and fast.
  • Anything extra.
  • Has no dependencies.
  • Focused only on Microsoft browsers.
  • Supports UMD: Browser (globals), AMD, CommonJS.
  • Written around 3000 tests. Coverage up to 100%.

Table of Contents

Install

NPM

npm install low-browser --save

Bower

bower install low-browser --save

Usage

Browser (globals)

  • Include script

    <script src="low-browser.min.js"></script>
    

    OR with a fast CDN

    <script src="https://unpkg.com/low-browser/low-browser.min.js"></script>
    
  • Work with script

    //...
    // If IE version 8.0
    if ( lowBrowser.version === '8.0' ) {
      // Do something
    }
    //...
    

AMD

In Asynchronous Module Definition need to use function parse

define ( 'your-module', ['low-browser'], function ( lowBrowser ) {
  // Parse user agent string
  lowBrowser.parse ( navigator.userAgent );

  // If IE version 8.0
  if ( lowBrowser.version === '8.0' ) {
    // Do something
  }
} );

CommonJS

Low browser can be used as CommonJS module

var lowBrowser = require ( 'low-browser' ).parse ( userAgent );

// If IE version 8.0
if ( lowBrowser.version === '8.0' ) {
  // Do something
}

What you get

Browser Name

May be IE or Edge.

lowBrowser.name

Browser Version

lowBrowser.version

Browser Core

May be Trident or EdgeHTML.

lowBrowser.core

Browser Core Version

lowBrowser.coreVersion

Operating System

lowBrowser.os

Operating System Build Number

Only for Edge.

lowBrowser.osBuild

Game Platforms

May be Xbox 360 or Xbox One.

lowBrowser.gamePlatform

Functions

parse

Parses a string of user browser. After that, you can get the information of browser. This function runs automatically if you want use this script on client side (not AMD).

lowBrowser.parse ( userAgent );

Where userAgent — string of user agent browser

Tests

  • Prepare

    # Clone repository
    $ git clone https://github.com/Arttse/low-browser.git && cd low-browser/
    
    # Install gulp globally
    $ npm i -g gulp
    
    # Install all dependencies for tests
    $ npm i
    
  • Run tests for node.js

    $ gulp test.node
    
  • Run tests for browser

    $ gulp test.browser
    
  • Run all tests

    $ gulp tests
    

License

MIT © 2015-2016 Nikita «Arttse» Bystrov

Keywords

FAQs

Last updated on 03 Nov 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc