Disable the annoying backward navigation that occurs when the user press the backspace key.
- Prevent browser back on backspace (by using
- 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
npm install backspace-disabler
Or just copy the code inside index.js into your codebase.
Require it with CommonJS loader (Browserify / Webpack...)
var BackspaceDisabler = ;// Disable the backspace that triggers backward navigationBackspaceDisabler;// Revert to normalBackspaceDisabler;// Can also be applied to a specific element tree:var myWidget = document;BackspaceDisabler;BackspaceDisabler;
The ideas of this lib come from StackOverflow