How to disable the AutoComplete option
Hi,
In my Jsp application, whenever I open my Login Page and enter Id and Password, I get a dialog box 'AutoComplete' with follow mesg.
--Do you want Windows to remember this password, so that you
don't have to type it again the next time you visit this page?
--Don't offer to remember any more passwords
My question = How u disable this option at the client browser through your Jsp application, as I don't want to give the user this option.
I know that you can check the -Don't offer option, to avoid.
But, how you implement it by your Jsp app.
Good question. (Googles a little, Experiments with it a little)
It is a non-standard tag attribute.
http://developer.mozilla.org/en/docs/How_to_Turn_Off_Form_Autocompletion
This form attribute is not part of any web standards but was first
introduced in Microsoft's Internet Explorer 5. Netscape introduced it in
version 6.2 -- in prior versions, this attribute is ignored. The
autocomplete attribute was added at the insistance of banks and card
issuers -- but never followed through on to reach standards certification.
The page goes on to recommend use of the attribute anyway.
Found this page that says it doesn't always on some versions:
http://wssg.berkeley.edu/SecurityInfrastructure/reports/AutoComplete/index.html
Page used to test:
<form>
<h2>Form with autocomplete at default</h2>
<table>
<tr><td>User name</td><td><input type="text" name="user"></td></tr>
<tr><td>Password</td><td> <input type="password" name="password"></td></tr>
<tr><td colspan="2"><input type="submit"></td></tr>
</table>
</form>
<hr>
<form>
<h2>Form with autocomplete password switched off</h2>
<table>
<tr><td>User name</td><td><input type="text" name="user"></td></tr>
<tr><td>Password</td><td> <input type="password" name="password" autocomplete="off"></td></tr>
<tr><td colspan="2"><input type="submit"></td></tr>
</table>
</form>
<hr>
<h2>Form with autocomplete switched off at form level</h2>
<form>
<table>
<tr><td>User name</td><td><input type="text" name="user" autocomplete="off"></td></tr>
<tr><td>Password</td><td> <input type="password" name="password"></td></tr>
<tr><td colspan="2"><input type="submit"></td></tr>
</table>
</form>
Couple of interesting points to note:
With IE, if I said "no" saving the password, it still remembered the username, and the fact that I had previously said "no" to saving password. Had to keep using different user names to ensure it just wasn't "caching" username and my desire to not save password.
Firefox remember username/password when I navigated back to the page - as long as I got the master password right. IE only populated the password when I typed in the same username and auto-completed.
Well that was interesting.
Cheers,
evnafets
Yeah, that one occurred to me to.
You can't directly, because the html:text component doesn't declare it as an attribute.
Alternatives: just use a manual <input type="text"> or more likely, <input type="password">
A more tricky javascript way, would be to dynamically set the variable with javascript after the page is loaded.
Neither way is optimal, but thats life.