Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.location.replace doesn't work?

Status
Not open for further replies.

sharapov

MIS
May 28, 2002
106
0
0
US
Hello,

I have a form that I am submiting. What I want is to call "window.location.replace" when form is submited to prevent users from going back to the form by pressing back button. Below is the code I use, however when I submit the form I can still use back button to go the form. Can anybody help?

Code:
<form onsubmit=&quot;window.location.replace('1.php');&quot; method=&quot;POST&quot; action=&quot;3.php&quot;>
<select size=&quot;1&quot; name=&quot;D1&quot;></select>
<input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;>
</form>
 
You'll need to place this code window.location.replace('1.php') in you 3.php page, for it to work.

MrGreed

&quot;did you just say Minkey?, yes that's what I said.&quot;
 
MrGreed,

&quot;window.location.replace&quot; replaces page history of the page it is called in. If I do something like this <body onload=&quot;window.location.replace('1.php')&quot;> on my 3.php (just like you are proposing) after it is loaded it will replace 3.php with 1.php right away without giving a user chance to look at 3.php.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top