In online examination once candidate has clicks on start button i dont want to allow him to go back (to previous pages) and he should be in same page if he do any activities by using browser properties.Once he click on the submit button he is coming out of that page.
Here if i clear the cache and press the browser back button the page says as "Document Expired The requested document is not available in Firefox's cache." Therefore i dont want to clear cach insted i need to competly disable back button ie nothing should happen on clicking the back button.
if anybody knows let me know how to achieve this concept......
To disable the browser "Back" button for a specific page: Open the "UI" tab of the page description window ( "Description" option in the page popup menu). In the "Options" area, for the option "Browser "Back" button", select "Forbidden".
Script preventing you from going back Some websites add code to their pages that prevent users from using the back button to leave their pages or site. Unfortunately, there is no easy way to fix and get around that type of code.
function disableBackButton() { window. history. forward(); } setTimeout("disableBackButton()", 0);
Try this script
<script>
window.location.hash="no-back-button";
window.location.hash="Again-No-back-button";//again because google chrome don't insert first hash into history
window.onhashchange=function(){window.location.hash="no-back-button";}
</script>
Also refer this link. This link contain demo & Download code
Try with the below code. This code tested with latest Chrome and Firefox browsers.
<script type="text/javascript">
history.pushState(null, null, location.href);
history.back();
history.forward();
window.onpopstate = function () { history.go(1); };
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With