npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

what-browser-am-i

v0.7.2

Published

A library for client-side web browser determination.

Downloads

16

Readme

what-browser-am-i

Library for client-side web browser judgment. It has been developed to work with a wide range of DHTML browsers, both old and new.

Prior to August 7, 2020, development was done at itozyun/web-doc-base.

Prime Minister Abe nearly loses the name of the school's chairman, who was told by Mrs. Akie that "his enthusiasm was wonderful".

Prime Minister Abe nearly loses the name of the school's chairman, who was told by Mrs. Akie that "his enthusiasm was wonderful". TV TOKYO, source (e.g. quotation)

Index

  1. Features
  2. Folders
  3. Test Page
  4. Usage
    1. Properties
    2. Method
      1. conpare(v1, v2)
  5. Development
    1. Preparation
    2. Development
    3. Distribute
    4. Include what-browser-am-i as a submodule in your project
  6. License

1. Features

  1. Even if the visitor has checked "Request desktop site" and the UA is spoofed, the correct engine will be retrieved. In addition, you can detect the viewer's intention to "Prefer desktop version".
  2. Third-party browsers for Android and iOS use the same WebView but have different viewport behavior, such as address bar behavior. Therefore, retrieve the brand name.
  3. It works on IE4 or later because in operator and instanceof operator and try~catch statements are not used. Also, it works on mobile IE4 because it does not use regular expressions.

2. Folders

| Directories | Sub Direcories | Description | |:------------|:---------------|:--------------------------| | dist/ | | Placement of built files. | | docs/ | | The index.html file for executing the browser judgment is placed, but not attached to the npm package. If necessary, the contents can be found on github pages . | | src/ | js | source codes | | | js-externs | Variable and property names to be protected from renaming by specifying them in externs of the Closure Compiler. |

3. Test Page

4. Usage

const whatBrowserAmI = require('what-browser-am-i');

console.log(whatBrowserAmI.ENGINE); // Trident
console.log(whatBrowserAmI.ENGINE_VERSION); // 8

or

<html>
<script src="./whatBrowserAmI.js"></script>
<script>
console.log(whatBrowserAmI.ENGINE); // Gecko
console.log(whatBrowserAmI.ENGINE_VERSION); // "1.9.1"
</script>

4.1. Properties

| Property | Data type | Example | |:-------------------|:-----------------|:--------------| | PLATFORM | string | | | PLATFORM_VERSION | string\|object | | | ENGINE | string | | | ENGINE_VERSION | string\|object | | | BRAND | string | | | BRAND_VERSION | string\|object | | | DEVICE | string | | | DEVICE_VERSION | string\|object | | | PCSITE_REQUESTED | boolean | true | | DEVICE_TYPE | number | |

4.2. Method

4.2.1 conpare(v1, v2)

Compares the size of the version number(string). The last 0 is ignored, so "2.0.0" and 2 are considered equal.

// Firefox 3.5<=
isFirefoxGte35 = whatBrowserAmI.Gecko && 0 <= whatBrowserAmI.conpare(whatBrowserAmI.ENGINE_VERSION, '1.9.1');
Arguments

| Name | Data type | Example | |:---------|:-----------------|:-----------------| | v1 | string\|number | "1.9.1", 1.9 | | v2 | string\|number | "1.9.1", 1.9 |

Return Value

| Value | Description | Example | |:----------|:------------|:----------------------| | 1 | v1 > v2 | "1.9.1" > 1.9 | | 0 | v1 == v2 | "1.9.0" == 1.9 | | -1 | v1 < v2 | "1.9.1" < "1.9.2" |

5. Development

5.1 Preparation

git clone https://github.com/itozyun/what-browser-am-i
npm install

5.2 Development

After making the changes under ./src/, execute the following command. Then browse docs/index.html with a browser to check.

gulp docs

5.3 Distribute

Update the distribution files ./dist/index.js and ./dist/whatBrowserAmI.js with the following command.

gulp dist

5.4 Include what-browser-am-i as a submodule in your project

web-doc-base/gulpfile.js is helpful.

5.4.1 Use optimization option

  1. Compile with DEFINE_WHAT_BROWSER_AM_I__MINIFY=true.
  2. All properties and names are provided numerically. This constant is located in ./src/js/0_global/*.js.
  3. web-doc-base/src/js-inline/dynamicViewPort.js, etc., to obtain the required values.

5.4.2 Build options

Closure Compiler @define.

| Variable | Data type | Default value | Note | |:-----------------------------------------------------|:----------|:--------------|:------------------| | DEFINE_WHAT_BROWSER_AM_I__MINIFY | boolean | false | Since version 0.6 | | DEFINE_WHAT_BROWSER_AM_I__BRAND_ENABLED | boolean | true | | | DEFINE_WHAT_BROWSER_AM_I__PCSITE_REQUESTED_ENABLED | boolean | true | | | DEFINE_WHAT_BROWSER_AM_I__IOS_DEVICE_ENABLED | boolean | true | | | DEFINE_WHAT_BROWSER_AM_I__DEVICE_TYPE_ENABLED | boolean | true | |

6. License

what-browser-am-i is licensed under MIT License.

(C) 2021-2024 itozyun(outcloud.blogspot.com)