Sagar Bandkar

Sagar Bandkar

  • 1.1k
  • 347
  • 48.8k

Disable Back button of browser after Login

Nov 8 2016 11:58 PM
I want to disable back button of any browser after Successful Login but not all pages
only next page after Login.I use Javascript but browser arrow seen
Code:-
 
<script>
function disableBackButton() {
window.history.forward()
}
disableBackButton();
window.onload = disableBackButton();
window.onpageshow = function (evt) { if (evt.persisted) disableBackButton() }
window.onunload = function () { void (0) }
</script>
<body onload="disableBackButton()">
 
but this Code forcefully back and that time back page seen
any Solution to disable back arrow of browser 

Answers (5)