How to Disale Back Button Of browser?

Posted by sarnaiksuraj-12609 under ASP.NET on 11/25/2011 | Points: 10 | Views : 1318 | Status : [Member] | Replies : 3
After Click on log-out button i kill session and redirect on lo gin page .but when i click back button of browser it will navigate on my account.it should not happen .
so give me suggestion..




Responses

Posted by: RohiK on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down


check this out

http://www.dotnetfunda.com/forums/thread1949-disable-back-button-browser.aspx

Happy Programming!!
Rohi

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Shijohnjoseph on: 11/25/2011 [Member] Starter | Points: 25

Up
0
Down
<script type="text/javascript" language="javascript">
function disableBackButton()
{
window.history.forward()
}
disableBackButton();
window.onload=disableBackButton();
window.onpageshow=function(evt) { if(evt.persisted) disableBackButton() }
window.onunload=function() { void(0) }
</script>

then call noBack() function on <body> on the following way:
<body onload="noBack();">

"Personality has the power to open many doors, but character must keep them open"

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Arefin on: 11/26/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Sarnaik.suraj@gmail.com,
Just follow Shijohnjoseph's code. And Thank you @Shijohnjoseph.

Thanks,
Arefin

sarnaiksuraj-12609, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response