Thursday, March 22, 2018

Turn Off Auto-Complete for all browsers

While we all love the auto-complete function on browsers, there may be a reason to turn it off.  Mainly, for security reasons, like on banking sites.

This is a hack and the only solution that will work on all browsers. 

Add the following to all fields that you don't want to auto-fill:

readonly onfocus="this.removeAttribute('readonly');" style="background-color:white;"

What happens is, when the page loads, the fields are read only. Once the user clicks on the field to enter a value, the readonly attribute is removed.

Now, an important part of this is to make sure you add a white background so the fields don't appear to be readonly.

That's it!

nJoy.

No comments:

Post a Comment