Skip to content

Returns whether a given browser supports headless mode.

License

Notifications You must be signed in to change notification settings

airtap/headless-support

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

headless-support

Returns whether a given browser supports headless mode.

npm status node Travis build status JavaScript Style Guide

Usage

const headless = require('headless-support')

console.log(headless('chromium', 59, 'linux')) // true
console.log(headless('edge', 59, 'win32'))     // false
console.log(headless('edge', 60, 'win32'))     // true
consoke.log(headless('ff', 56, 'darwin'))      // true

API

headless(name[, version][, platform])

Arguments:

  • name (string): browser name, loosely matched with browser-names
  • version (number or string): browser version, either a major version number (e.g. 85) or a full version string ('85.0.564.68'). If version is falsy then latest is assumed.
  • platform (string): defaults to process.platform

Returns a boolean that indicates support of headless mode. For Chromium-based browsers it means they accept a --headless flag on the command line, for Firefox it means the browser accepts a -headless flag.

Install

With npm do:

npm install headless-support

License

MIT © 2020-present Airtap contributors