Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Disabling Back button using Location.replace


Message #1 by "Christian Cryder" <christianc@e...> on Wed, 15 Aug 2001 11:40:09 -0600
Hi guys,

I have a Javascript question. Let's say the user presses a link in a page.
If I want the new url to replace the current page in history (ie.
eliminating the ability to go back to the page I was just on), I can set the
Anchor element's 'onclick' attribute like this:

	onclick="location.replace(this.href); return false;"

What I need to know how to do is the same type of thing from within a Form.
In other words, when the user submits the form, I want the submit to occur
as expected, but I'd like for them not to be able to hit back and return to
the page that they just left.

Can I do the same type of thing (and just replace the url before doing a
form.submit())? I don't think that will work since location.replace actually
causes the newly specifed location to be loaded.

Suggestions?

Thanks much,
Christian
------------------------------------------------
Christian Cryder [christianc@e...]
Barracuda - MVC Component Framework for Webapps
http://barracuda.enhydra.org
------------------------------------------------
        "What a great time to be a Geek"


  Return to Index