Safari Keychain prevent with html

岁酱吖の 提交于 2019-12-02 09:47:54

问题


Solve

i search this problem before day for my project. and finally i found the solution wit plug-in below.

this plug-in work structure like this. It get your input and clone it. Use this clone and create same input properties and clone it another hidden input. After that remove your orginal input and put hidden and cloned input same position.

It's reason that. Modern browser (has keychain) control input (type password) when page loaded and mapped over DOM. After page load plug-in get input and clone and remove orginal input. this operation changes DOM mapping. So brovser cannot access this control when page redirect. So don't suggest yo to save password.

You can use this plug-in for this problem.

Notes:

If you use another plug-in like me. Forexample jquery-keyboard plug-in for password secure enter. you shoul modify your initkeyboard method. becasue keyboard control your input and init near this input. you could change this init method like below init keyboard changing

before

var _inputwidth = $(elm).parent().find('input').width();

after var _inputwidth = $(elm).parent().find('input[type=text],input[type=password]').width();

because plug-in output like this

<input type="hidden"  id="txtPass" name="txtPass" spellcheck="false" autocomplete="off">
<input type="text"  id="txtPass" name="txtPass" spellcheck="false" autocomplete="off">

If you have any keypress or keydown event initialize for this input put this codes after plug-in init. because this plug-in change DOM mapping this plug-in usage like below

$('input[type=password]').disableAutocomplete();

this is creator desctiption

This jQuery plug-in enforces the autocomplete=off HTML attribute on password (and other) fields. Recent browsers have chosen to ignore this attribute in favor of user preferences. However, some financial (and other) institutions may have good reasons to enforce this practice.

jQouery Disable AutoComplete

Old question

i have a page with 2 inputs. one of these input type password, other text (username password form). Safari doesn't work with autocomplete="off". I use for this problem two inline hidden input. These input has generic name like below. My original username password input has different name. So Safari think for keychain and firstly wants to get or set these input. you can use this solution for prevent Safari keychain for your secure page.

<input type="text" name="Username" style="display:none;"/>
<input type="password" name="Password" style="display:none;" />

来源:https://stackoverflow.com/questions/27960892/safari-keychain-prevent-with-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!