开发者

Prevent chrome from auto populating fields with e-mail/password?

I have a form that has a MAC Address field and a Password field and I have the chrome auto-fill options turned off, but when I load the page, chrome thinks the MAC Address should be an e-mail address and puts an e-mail address in there and for the password, it puts a password in there. Is there a way to prevent this behavior? Is there way to do this programmatically on page load, I tried clearing the fields, but that doesn开发者_如何学C't work.


I think your only hope is to use the autocomplete attribute and hope Chrome obliges. On the client side the browser can do whatever it wants, you just have to hope it plays nicely.

<input name="myMacAddress" ...  autocomplete="off" />

Another downside to this approach is autocomplete is not part of the standard.


This is a browser specific implementation.... You can use a Javascript to clear the contents when the page first loaded.... How to findout if the page is loaded first time... can be managed using a hidden field.


Turning off Form Autofill (aka autocomplete):

1. Click the Tools menu .
2. Select Options.
3. Click the Minor tweaks tab.
4. Deselect 'Save text from forms to make them easier to fill out.'
5. Click Save.

From google chrome help.


From server you can't control how Client handles the page.. so we have no way. You can only suggest user to take required action like deleting the email for that domain or turning off autofill.


I was having the same issue with a few search fields in my web application. Wrapping the control inside a form tag works.

<form autocomplete="off">
 <input value="" autocomplete="off" class="form-control" placeholder="search." /></form>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜