Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More

is-in-browser

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-in-browser

Simple check to see if current app is running in browser


Version published
Weekly downloads
2.1M
decreased by-0.41%
Maintainers
1
Weekly downloads
 
Created

Is In Browser?

import isBrowser from "is-in-browser";

if (isBrowser) {
  //...
}

More thoroughly:

import { isJsDom, isNode, isBrowser } from "is-in-browser";

if (isBrowser) {
  // you're in the browser
  // jsdom considered in browser
}

if (isJsDom) {
  // you're in the JSDom
}

if (isNode) {
  // you're in the Node
}

CommonJS

For those not using Babel / ES6 Modules

var isBrowser = require('is-in-browser').default;

if(isBrowser) { //... }

FAQs

Package last updated on 07 Feb 2021

Did you know?

Socket

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