1.0.2 • Published 8 years ago

browser-permission-prompts v1.0.2

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

browser-perimission-prompts Build Status

On-screen locations (x, y) for permissions prompts in major desktop browsers

Supports:

  • Chrome
  • Firefox
  • Safari

Install

$ npm install --save browser-permission-prompts

Usage

var prompt = require('browser-permission-prompts')

prompt()
//=> {...}

You'll receive the following data (using Chrome as an example):

{
  "prompt": [
    {"x": 80, "y": 4},
    {"x": 410, "y": 4},
    {"x": 410, "y": 118},
    {"x": 80, "y": 118}
  ],
  "confirm": {
    "x": 347.5
  }
}

The prompt coordinates represent the top-left, top-right, bottom-right, and bottom-left coordinates of the prompt, respectively. The confirm x coordinate represents the horizontal midpoint of the confirmation action.

All measurements are relative to the document viewport, not the browser chrome.

API

prompt() -> object / undefined

Returns the prompt coordinates for the current browser. If the library does not support the current provider, undefined is returned instead.

License

MIT © Ben Drucker