Disabling Safari autofill on usernames and passwords

后端 未结 17 1721
萌比男神i
萌比男神i 2020-11-29 03:52

You might already know, that Safari has a nasty autofill bug where it fills email, username and password fields no matter if you set autocomplete=\"off\" or not

17条回答
  •  粉色の甜心
    2020-11-29 04:29

    I had the same problem suddenly in a SPA with React in Mobile Safari 10.3.1

    I do not need any tricky workarounds before in all tested browsers, even Mobile Safari IOS 10.2

    But since 10.3.1 username or password will be filled in fields mentioning the words 'password','email','username' in any forms after login with active remember option. It seems that the rendered DOM-Tree is 'analyzed' using a full text search and then the user agent fill in data without respecting any autocomplete="off" setting. Happens funnyli also on placeholder text for a field. So you must be very carful with naming, when you don't want to have prefilled username or password in places where this data is not useful.

    The only solution after hours of investigating was the solution here posted too. Provide a input field named "email" and hideout the containing div with height: 0px, overflow: hidden.

提交回复
热议问题