[英]AutoComplete- Off Not working
我的 android 活動中有一個 webiview。 在那個 webview 中,我上傳了一個原生的 html 頁面。 HTML 頁面包含輸入文本字段。 我正在嘗試使用自動完成功能來關閉建議。 但是 Autocomplete -off 在 android 中不起作用。當我嘗試輸入一些文本時,一些建議仍然存在。
我正在嘗試的代碼如下
<tr>
<td style="position:absolute; top:5%;height:35px;width:100%;" >
<input type="text" id="userName" placeholder = "User Name" autocomplete ="off" >
</td>
</tr>
請嘗試:
WebView.getSettings().setSavePassword(false);
WebView.clearFormData();
如果你加載你已經創建的 HTML 本機頁面,然后打開 html 頁面並更改它的類型,它可能會從 java-Script 完成。 只需刪除它。
如果可能的話,只需在此處發布您的 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>
您的 input 元素沒有 name 屬性。 這就是為什么它不工作。
<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 在表單級別不支持autocomplete="off"
。
有兩種解決方案:
在您的表單中,如果只有兩個或三個字段忽略autocomplete="off"
,則使用字段名稱本身作為自動完成值。 即autocomplete=<input field name>
<form:input type="text" id="name" path="name" autocomplete="name"/>
不要為每個字段手動定義字段名稱,而是在頁面加載時或之后為所有輸入的文本使用腳本。
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.