1.1.0 • Published 2 years ago

get-private-browsing-name v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
2 years ago

Build Status npm npm npm bundle size

Get Private Browsing Name

A micro-package (< 3kb min) that returns the current browser's name for "private browsing" (Incognito/InPrivate/Private Browsing) and phrase displayed when right clicking on a link.

Installation

Depending on your package manager of choice

  • yarn add get-private-browsing-name, or
  • npm install get-private-browsing-name

Conceptual usage

image

General rule of thumb:

  • Safari: Private Browsing Mode
  • Gooogle Chrome: Incognito Mode
  • Microsoft Edge: InPrivate Browsing Mode
  • Mozilla Firefox: Private Browsing
  • Opera: Private Browsing

Test cases

Run yarn test to see test cases

Example

// Example Running in macOS Chrome
import getPrivateBrowsingName from 'get-private-browsing-name';
console.log(getPrivateBrowsingName());
// Logs the following
// {
//   browser: "chrome",
//   mode: "Incognito",
//   linkMethod: "Open Link in Incognito Window",
//   macMethod: 'Command⌘+Shift+p',
//   detectedMethod: 'Command⌘+Shift+p',
//   windowsMethod: 'Ctrl+Shift+p',
//   regex: /(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/
// }

Changelog

1.1.0 - Fixes hard crash. Adds Opera support. Fixes Chrome/Firefox-on-iOS tests.

1.0.0 - Stable release

1.1.0

2 years ago

1.0.0

3 years ago

0.2.0

3 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago