...

View Full Version : history.back()



tram
05-15-2007, 06:01 AM
what's the problem with the code below?
in Opera, clicking the back button displays the submitted form along
with the inputs.
in Mozilla, the inputs are all gone...

<input type="button" value="Go Back" onClick="window.self.history.back()" >

_Aerospace_Eng_
05-15-2007, 06:12 AM
Nothing is wrong with it persay. Browsers handle forms differently. Some keep the data, some don't. Firefox is one that doesn't unless you tell it to. Instead of this

<input type="button" value="Go Back" onClick="window.self.history.back()" >
I would try

<input type="button" value="Go Back" onClick="history.go(-1)">
That probably won't change anything but its shorter.

_Aerospace_Eng_
05-15-2007, 06:13 AM
Nothing is wrong with it persay. Browsers handle forms differently. Some keep the data, some don't. Firefox is one that doesn't unless you tell it to. Instead of this

<input type="button" value="Go Back" onClick="window.self.history.back()" >
I would try

<input type="button" value="Go Back" onclick="history.go(-1)">
That probably won't change anything but its shorter.

tram
05-15-2007, 06:41 AM
but how can i retrieve the inputs? it is impt. that the submitted form (w/ the inputs) be displayed

felgall
05-15-2007, 06:50 AM
To do that you need to use a browser that keeps the inputs.

liorean
05-15-2007, 07:27 AM
There is no guarantee that forms ill be correctly filled when using the browser history - not in any browser. To solve that for all cases, you need to do it server side. Which you should probably be doing anyway, it's good form design.

FJbrian
05-15-2007, 02:02 PM
I have no experience with it but yahoo yui has a nice browser history added to the library now.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum