Socket
Socket
Sign inDemoInstall

prevent-parent

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    prevent-parent

Prevent keydown events from reaching the parent page for iframed pages. Useful for games that use arrow keys for input and are displayed on a gallery page.


Version published
Maintainers
1
Install size
2.57 kB
Created

Readme

Source

prevent-parent

Prevent keydown events from reaching the parent page for iframed pages. Useful for games that use arrow keys for input and are displayed on a gallery page.

Install

npm install --save prevent-parent

Use

Call preventParent() once after your app loads.

Syntax

preventParent([optional-keycode-list])

optional-keycode-list:

list of key codes, defaults to arrow keys ['ArrowDown', 'ArrowUp', 'ArrowRight', 'ArrowLeft']

Examples

prevent arrow keys

import preventParent from 'prevent-parent';

// prevent parent window form scrolling
preventParent();

pass in custom list of keycodes

import preventParent from 'prevent-parent';

// prevent Space and ShiftRight keys in parent
preventParent(['Space', 'ShiftRight']);

Keywords

FAQs

Last updated on 23 Jul 2019

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