Disable Back Button Browser With Javascript

when we create a website or web-based application, often we want to disable the back button on your browser for security reasons or for other reasons.
with this javascipt function we can force the browser to perform forward every time the back button is pressed.
here is the script

1
2
3
4
5
6
7
8
9
10
11
12
13
function backButton()
{
	setTimeout('backButtonBody()', 1)
}		
function backButtonBody()
{
	try
	{
		history.forward()
	}
	catch (e) {}
	setTimeout('backButtonBody()', 500);
}

And for calling the script, we simply add it to the body tag.

<body onLoad="backButton()">

i hope this script can help your problem.