In this javascript tutorial you will learn how to disable the back button on FireFox's browser or how to prevent the user to go back in FireFox’s browser. Although I am giving force to FireFox's browser yet this code works for all web browsers such as Google Chrome, Opera, Safari, Internet Explorer etc. The reason why I am giving force over FireFox because it is even hard in FireFox to disable the back button or to prevent user to go back.
For example, the below mentioned code will work in other web browsers such as Internet Explorer, Google Chrome but will not perform his responsibility incase of FireFox.
For example, the below mentioned code will work in other web browsers such as Internet Explorer, Google Chrome but will not perform his responsibility incase of FireFox.
<script language="javascript" type="text/javascript">
window.history.forward(1);
</script>
Also this code will work in other browsers but in case of FireFox it will not work
<script language="javascript" type="text/javascript">
if(history.back)
{
history.go(+1)
}
</script>
So now let's have a look over javascript code that will disable the back button and prevent user to go back in Firefox and in all other browsers
<script language="javascript" type="text/javascript">
function noBack()
{
window.history.forward()
}
noBack();
window.inhibited_load=noBack;
window.onpageshow=function(evt){if(evt.persisted)noBack()}
window.inhibited_unload=function(){void(0)}
</script>
So this is the way to disable the back button on firefox and prevent user to go back.
0 comments:
Post a Comment