Disable the annoying browser backward navigation when the user press the backspace key
MIT License
Disable the annoying backward navigation that occurs when the user press the backspace key.
preventDefaut()
)NPM:
npm install backspace-disabler
Or just copy the code inside index.js into your codebase.
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);
The ideas of this lib come from StackOverflow
Looking for a React/ReactNative freelance expert with more than 5 years production experience? Contact me from my website or with Twitter.