问题描述
可能重复:结果
How你对网页表单域禁止浏览器自动完成/输入标记?
我建立在键入时,让本地搜索建议我自己的本地搜索UI元素。我遇到的问题是,当我专注于HTML文本输入元素在我的浏览器(Safari浏览器,但在其他浏览器可能发生)显示基于我在过去已经输入的东西自己的文字建议。
I am building my own local search UI element that gives local search suggestions as you type. The problem I am having is that when I focus on the html text input element my browser (Safari, but could happen in other browsers) displays its own text suggestions based on things that I've typed in the past.
我的猜测是,这是依赖于在&lt ID或类; input>标记。所以很可能,如果我改变输入标签类的东西模糊,浏览器不会有任何的建议提供。但我不知道,如果没有一个更优雅的方式...
My guess is that this is dependent on the ID or Class of the < input > tag. So probably, if I change the input tag class to something obscure, the browser will not have any suggestions to offer. But I wonder if there isn't a more elegant way...
一个相关的问题是,当你专注于在&lt这种情况发生在Safari中的文本字段突出; input>元素。当我填补了Facebook上的形式,我没有看到这个大纲。这将是巨大的听到,如果有人知道如何处理这两个问题。
A related issue is about text field highlighting that happens in Safari when you focus on the < input > element. When I am filling up a form on Facebook, I don't see this outline. It would be great to hear if someone knows how to handle those two issues.
推荐答案
基于Gecko的浏览器都支持所谓的自动完成的标记属性。因此,在你的&LT;形式&GT;
标记你会把&LT;形式自动完成=关闭方式&gt;
Gecko-based browsers support a tag attribute called "autocomplete". So in your <form>
tag you would put <form autocomplete="off">
.
这里更多:https://developer.mozilla.org/en/How_to_Turn_Off_form_Autocompletion
其他一些浏览器有这个问题,以及支持。我相信,IE会兑现这一点。
Some other browsers have support for this as well. I believe IE will honor this.
这篇关于preventing浏览器文本输入建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!