差異處

這裏顯示兩個版本的差異處。

連向這個比對檢視

Both sides previous revision 前次修改
下次修改
前次修改
java:web:wicket:dont_autocomplete [2018/11/09 18:17]
tony
java:web:wicket:dont_autocomplete [2023/06/25 09:48] (目前版本)
行 21: 行 21:
 <code html> <code html>
 <input type="​password" ​ readonly <input type="​password" ​ readonly
-     ​onfocus="​this.removeAttribute('​readonly'​);​this.select();​ this.selectionStart = this.selectionEnd = this.value.length;"/>​+     ​onfocus="​this.removeAttribute('​readonly'​);​this.select();​ this.selectionStart = this.selectionEnd = this.value.length;"​ 
 +     ​onblur="​this.setAttribute('​readonly','​readonly'​);"​  
 +    ​/>
 </​code>​ </​code>​
-在IE上如果僅移除readonly屬性,會造成點擊兩次才能夠輸入密碼的問題必須透過再次選取與調整游標位置去讓使用者無痛。最後我們有使用這方法,主要是由於我們使用Apache Wicket,這種方式比較容易做成可重複使用的元件。+在IE上如果僅移除readonly屬性,會造成點擊兩次才能夠輸入密碼的問題必須透過再次選取與調整游標位置去讓使用者無痛;onblur是為了避免使用者按tab又觸發autocomplete的問題。最後我們有使用這方法,主要是由於我們使用Apache Wicket,這種方式比較容易做成可重複使用的元件。
 ==== Apply autocomplete="​nope"​ or autocomplete="​off"​ ==== ==== Apply autocomplete="​nope"​ or autocomplete="​off"​ ====
 這方法不推薦使用。目前我知道autocomplete="​off"​可以使用於IE,但autocomplete="​nope"​只能用於chrome與firefox的某些版本。 這方法不推薦使用。目前我知道autocomplete="​off"​可以使用於IE,但autocomplete="​nope"​只能用於chrome與firefox的某些版本。
行 97: 行 99:
 \\ \\
 如果真的要完全解決這問題,請別使用password。 如果真的要完全解決這問題,請別使用password。
 +===== 後記 =====
 +之前曾寫過類似文章,方法與前面提到的類似,本篇文章更為完整。
 +  * [[java:​web:​browserAutocomplete|Autocompletion problem on Firefox or Chrome]]
 ===== Reference ===== ===== Reference =====
   * [[https://​jsfiddle.net/​449Lamue/​6/​|demo - 使用text模擬password]]   * [[https://​jsfiddle.net/​449Lamue/​6/​|demo - 使用text模擬password]]