View Full Version : How do browsers remeber what you typed in a textbox?

01-11-2003, 10:20 AM
Hello members,

I have this understandable desire to figure out how does browsers remember what you typed in a textbox?

For instance: I type in "speed bikes" then click search. when i click on the back button the textbox still says "speed bikes". What causes this and most important can I do something with it.

I did a small test something like this

IF (textbox == "speed bikes")
document.write("speed bikes")

WEELLL,, I type in speed bike click search, go back and it doesn't do the document.write

No idea.......

01-11-2003, 11:43 AM
it wont do the document.write because its using the cached version of the page, and its displaying it how you left it, with "speed bikes" in the textbox... (erm... thats what i think anyways...)

01-11-2003, 02:51 PM
Yeah that's it; but it's pernitious - the data is there, and can be resubmitted, but if you try to read it through javascript, it returns an empty string!

But if you go

textBoxObj.value ="";

and you trigger it from <body onload, then the box will be auto-cleared when you press back.

01-11-2003, 08:28 PM
can't you just use cookies?

01-12-2003, 02:43 AM
Yeah I thought it had to do something with cache. I just find it unusal that the entered text stays there but the dynamic stuff don't even if you test the cached text.

I could use cookies but don't know how. I've read up and down this forum and see a repeat of "document.cookie". for some reason even if I copy the script provided by the member, it still doesn't work..