Search This Blog

2009-05-14

Disable Back Button in the browser

You can disable the functionality of the back button by the following function of javascript.Write the following code in your HTML page

<script language="javascript" type="text/javascript">
window.onload=onLoadFunctions;

function onLoadFunctions()
{
backButtonOverride();
}
function backButtonOverride()
{

setTimeout("backButtonOverrideBody()", 0);

}

function backButtonOverrideBody()
{

try {
history.forward();


}
catch (e)
{
// OK to ignore
}

setTimeout("backButtonOverrideBody()", 0);
}
</script>

No comments: