[英]AutoComplete- Off Not working
I have a webiview in my android Activity.我的 android 活动中有一个 webiview。 In that webview i am uploading a native html page.在那个 webview 中,我上传了一个原生的 html 页面。 the HTML page contains input text field. HTML 页面包含输入文本字段。 I am trying to use autocomplete-off to make Off Suggestions.我正在尝试使用自动完成功能来关闭建议。 But Autocomplete -off not working in android .some suggestions are still there when i try to input some text.但是 Autocomplete -off 在 android 中不起作用。当我尝试输入一些文本时,一些建议仍然存在。
Code i am trying is given below我正在尝试的代码如下
<tr>
<td style="position:absolute; top:5%;height:35px;width:100%;" >
<input type="text" id="userName" placeholder = "User Name" autocomplete ="off" >
</td>
</tr>
Please try:请尝试:
WebView.getSettings().setSavePassword(false);
WebView.clearFormData();
I got you if you load HTML native page which you already created then open html page and change type of it it may be completed from java-Script.如果你加载你已经创建的 HTML 本机页面,然后打开 html 页面并更改它的类型,它可能会从 java-Script 完成。 just remove it.只需删除它。
and if possible just post your android code here so I can take a look at it and tell you that if there is any error in android code.如果可能的话,只需在此处发布您的 android 代码,以便我查看它并告诉您 android 代码中是否有任何错误。
<form name="form1" id="form1" method="post" autocomplete="off" action="........">
Name: <input type="text" name="text1" /><br/>
Address: <input type="text" name="text2" /><br/>
Phone: <input type="text" name="text3" /><br/>
Password: <input type="password" name="password" /><br/>
<input type="Submit" name="Submit" value="Submit" />
</form>
your input element doesn't have the name attribute.您的 input 元素没有 name 属性。 thats why its not working.这就是为什么它不工作。
<tr>
<td style="position:absolute; top:5%;height:35px;width:100%;" >
<input type="text" name="textbox1" id="userName" placeholder = "User Name" autocomplete ="off" >
</td>
</tr>
Chrome does not support autocomplete="off"
at the form level for some input fields.对于某些输入字段,Chrome 在表单级别不支持autocomplete="off"
。
There are 2 solutions to do so:有两种解决方案:
In your form, if only two or three fields ignore autocomplete="off"
, then use the field name itself as the autocomplete value.在您的表单中,如果只有两个或三个字段忽略autocomplete="off"
,则使用字段名称本身作为自动完成值。 ie autocomplete=<input field name>
即autocomplete=<input field name>
<form:input type="text" id="name" path="name" autocomplete="name"/>
Instead of defining field name manually for each field, use a script for all text typed input at the loading of the page or after.不要为每个字段手动定义字段名称,而是在页面加载时或之后为所有输入的文本使用脚本。
if ($.browser.chrome) { $(document).on('focus click tap', 'input', function() { $(this).attr("autocomplete", 'block'); }); } else { $(document).on('focus click tap', 'input', function() { $(this).attr("autocomplete", 'off'); }); }
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.