permaculture playing cards
The moose likes HTML, CSS and JavaScript and the fly likes Preventing from browser caching data? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Preventing from browser caching data?" Watch "Preventing from browser caching data?" New topic

Preventing from browser caching data?

Mallik Avula
Ranch Hand

Joined: Nov 30, 2006
Posts: 86
HI Friends
We enter data into some text field and submitted. When we comeback to that page and enter a character, it will display all previous entered data which start with that character.
How to prevent this?
Can any body help me?
thanks in advance

Thanks & Regards<br />Mallik Avula<br />SCJP1.4
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Add autocomplete="off" to the form element. It will keep the browser from showing the information.

Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
Does autocomplete work for Firefox as well or is that just an IE thing? In my case I use mostly Struts tags which do not support the autocomplete attribute so I had to come up with a different solution. My solution was to use the following call to disable autocomplete for all fields on the form:


- Brent
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Autocomplete works in my copy of Firefox. But don't you have Firefox installed on your computer? If you have this question, then really you should install it, so you can test your application in it.
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I threw out my solution because it seems slightly more standards compliant. But then again auto-completion of fields is not a defined standard so I am not sure there is really a way to do something non-standard and still stick with the standards. In my case, adding an autocomplete attribute to input tags causes XHTML validation messages and does not work when using Struts custom tags so setting the attribute on the form worked for me.

- Brent
I agree. Here's the link:
subject: Preventing from browser caching data?
It's not a secret anymore!