🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

backspace-disabler

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backspace-disabler

Disable the annoying browser backward navigation when the user press the backspace key

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

BACKSPACE DISABLER

Disable the annoying backward navigation that occurs when the user press the backspace key.

Features

  • Prevent browser back on backspace (by using preventDefaut())
  • Does not break ability of user to delete content on all known input types
  • Supports contentEditable (in read/edit mode)
  • Allow to apply the behavior globally or on a subtree
  • No dependency

Installation

NPM:

npm install backspace-disabler

Or just copy the code inside index.js into your codebase.

Usage

Require it with CommonJS loader (Browserify / Webpack...)

var BackspaceDisabler = require("backspace-disabler");

// Disable the backspace that triggers backward navigation
BackspaceDisabler.disable(); 
// Revert to normal
BackspaceDisabler.enable();

// Can also be applied to a specific element tree:
var myWidget = document.getElementById("myWidget");
BackspaceDisabler.disable(myWidget);
BackspaceDisabler.enable(myWidget);

Credits

The ideas of this lib come from StackOverflow

Keywords

browser

FAQs

Package last updated on 01 Feb 2017

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