Socket
Socket
Sign inDemoInstall

is-ua-webview

Package Overview
Dependencies
0
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-ua-webview

useragent parsing for webview detection


Version published
Weekly downloads
12K
increased by9.17%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

is-ua-webview

A super simple webview user-agent detector

Build Status

Installation

$ npm install is-ua-webview

Usage

const isWebview = require("is-ua-webview");

// just for testing:
const assert = require("assert");

// Facebook App embedded page load
assert(
  isWebview(
    "Mozilla/5.0 (Linux; Android 4.4.4; One Build/KTU84L.H4) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/28.0.0.20.16;]"
  )
);

// Chrome/Android browser
assert(
  !isWebview(
    "Mozilla/5.0 (Linux; Android 4.4.4; One Build/KTU84L.H4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Mobile Safari/537.36"
  )
);

Tests

Run tests

npm test

Why

This was built for a web service that wanted to add a logging point in case the page load came from inside a webview where cookies were possibly throw away (not treated the same as a SafariViewController or native browser load). The tests are lacking completeness as this tool was only being used to discover and add detection in logs. The author of this module is no longer the owner/maintainer of the production service that used this module, so if you are interested in using it, please consider adding more tests and make a PR with tests :)

Keywords

FAQs

Last updated on 01 Dec 2022

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