JS Code to stop reload webpages.
- Block Reload Button of the browser.
- Block
Ctrl + R
shortcut key. - Block
F5
key.
- Open any browser.
- Open any web page.
- Open Developer Options by pressing
Ctrl + Shift + I
. - Click on
Console
tab. - Paste the following code snippet :
window.addEventListener('keydown', function (event) {
if ((event.key === 'F5') || (event.ctrlKey && event.key === 'r') || (event.metaKey && event.key === 'r')) {
event.preventDefault();
}
});
setInterval(function() {
window.location.reload();
window.stop();
}, 1000);
- Click Enter Key.
- Close the Developer Options.
- Now when click on reload button on browser then it is disabled.