差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:web:wicket:dont_autocomplete [2018/11/22 22:41] tony [How to prevent the browser show remember login dialog?] |
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的某些版本。 |