Disallow browser back button functionality

liunx

Guest
Hi all,<br />
<br />
I am in a situation where I want to disallow the browser back button functionality with in the current page, so that the user stays in the current page.<br />
<br />
Can anyone help me out in this<br />
<br />
Thanks in Advance,<br />
Hari<!--content-->I have no idea how you would do this. There is probably a JavaScript snippet that does it. I'm just curious as to why you would want to do this. As a rather avid surfer, I hate pages that take functionality away from me. If I can't go back, I'll probably close the browser and leave you're site perminantly. As far as I'm concerned, a website should give me information, not dictate exactly how I should be viewing it.<br />
<br />
Doog Xela<!--content-->Read this thread - <!-- m --><a class="postlink" href="http://www.htmlforums.com/showthread.php?threadid=672">http://www.htmlforums.com/showthread.php?threadid=672</a><!-- m --><!--content-->There is no real way to disable the back button, although there's a small trick:<br />
<br />
<body onUnload="leave()"><br />
<script><br />
function leave() {<br />
location.href=http://www.htmlforums.com/archive/index.php/("http://www.sumtihngsite.com")<br />
}<br />
</script><br />
<br />
although i must agree with doogxela, you only will lose visitors with those stupid tricks<!--content-->What exactly I want is when a user clicks the back button in a page, he should be in the same page, so that I can make the user to go to the specific menu screen by clicking on a button.<br />
<br />
any help would be appreciated<br />
<br />
Hari<!--content-->you can use the location.replace() method to add entries in the the history OVER existing ones. but you'd have to use that for each page and link. In the end, it wouldn't help out too much, but they would'nt be able to backtrack though your site. They would easily be able to exit it. <br />
<br />
I'm also very skechy about users trying tricks to change the way I expect the back forward refresh buttons operate. I realize that it might benefit the website designer, but you should put the website viewer as first priority.<br />
<br />
<br />
from <!-- w --><a class="postlink" href="http://www.devguru.com">www.devguru.com</a><!-- w --><br />
<br />
replace Method <br />
The replace method replaces the current History entry with the specified URL. After calling the replace method, you cannot navigate back to the previous URL using the browser's Back button. <br />
<br />
Syntax: location.replace(URL)<!--content-->
 
Back
Top