09-28-2012, 09:42 AM
This code works in Chrome, but not for Mozilla & IE9. Anyone any idea?
Thanks & appreciate ;)
09-28-2012, 10:10 AM
It works perfectly well in Firefox and IE8 for me. What is the context in your case? Where do you call it?
09-28-2012, 10:28 AM
Oh no, how come i got problem :'(
This is the tag here:
I want to get back values to the form when I click No button.
09-28-2012, 10:46 AM
<input type="button" value="No" onclick="history.back(-1);" />
09-28-2012, 11:58 AM
Still cannot, IE says "Webpage has expired". :(
Mozilla go back the form without values :(
and the worse for now is my Chrome also can't populate back the values already :(
09-28-2012, 12:12 PM
Ok ... so what you actually WANT to do is not history.back (which is exactly what happens when you click the browser back button) but instead you want to retrieve the previously entered values into your form inputs.
You could take a look at cookies or localStorage.
09-28-2012, 12:32 PM
I want to retrieve the previously entered values to my form inputs by using history.back(-1) but I have no idea why it doesn't work.
Perhaps, I have to check for cookies or localStorage or use session on it.
Thanks again :)
09-28-2012, 02:20 PM
I want to retrieve the previously entered values to my form inputs by using history.back(-1) […]
This is not how this method works. history is an object that adds an entry (a visited page) to the browser history. What you have done on/with that page after it has loaded doesn’t matter to the history entry. And if you have sent a form on the previous page, this page is expired and/or you need to reload the page in its original state. history.back() is the same as clicking the back button of the browser and different browsers work differently, i. e. some might store the entered data, and some might not. You shouldn’t rely on this to start with.
Rather, you need to create a link or another form that submits the entered values back to the previous page, but in reality, from a browser history point of view, this isn’t the previous page, this is a new entry in the browser history; like, you’re going to the next page which is looking exactly like the previous one, with the values entered.
09-28-2012, 04:06 PM
Oh I see, thanks for your awesome sharing ;) Appreciate .. !
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.