Socket
Socket
Sign inDemoInstall

@dvlden/is-webview

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @dvlden/is-webview

Detect if a visitor is coming through a webview or a native browser using user-agent.


Version published
Weekly downloads
83
increased by66%
Maintainers
1
Install size
3.57 kB
Created
Weekly downloads
 

Readme

Source

Is Webview

Is Webview

A utility module that takes user-agent string and determines whether it uses webview or native browser. It has been tested for Android and Apple devices with a few samples collected by running ads.

For my very specific use-case, it successfully detects viewing from Facebook, Instagram, Tiktok and Snapchat.

It does not rely on window.navigator.standalone for iOS, to allow Node.js to also use this module.


Installation

Use your favourite package manager... In my case that's pnpm.

pnpm i @dvlden/is-webview

Usage

Browser

import { isWebview } from '@dvlden/is-webview'

if (isWebview(window.navigator.userAgent)) {
  // do something
}

Node

const { isWebview } = require('@dvlden/is-webview')

if (isWebview(/* pass user-agent from the request */)) {
  // do something
}

Why?

Did you know that all of the apps that offer a webview experience (in-app browser), are tracking their users through it. This is especially true for social media apps. That's the main reason why I made this module; to help some websites escape tracking by telling visitors to tap on the ... from Webview and open the website in the browser, while keeping query parameters that social media appends for pixel tracking.

Keywords

FAQs

Last updated on 07 Oct 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