问题
I have come across a bug on a website I am working on with the credit card autofill iOS offers. I cannot offer a working example of this is as it requires a genuine SSL certificate in order for the autofill to appear on an iOS keyboard however I can actually get this to occur on Amazon's checkout too.
In essence the issue is that after having been offered to autofill having focused on any credit card enabled input it looks like all drop down input keyboards will also offer to autofill your credit card.
This happens even after a page refresh and even across different domains. All dropdowns will have autofill credit card
up until a non credit card plain text input has been focused on.
Below is a simplified version of the problem:
<input id="cardNumber"/> <!-- <-- Activates autofill -->
<select id="normalSelect">
<option>1</option>
<option>2</option>
<option>2</option>
</select>
<input id="normalInput"/>
- Touch
#cardNumber
and be offered to autofill on the keyboard - Touch
#normalSelect
(or any non-credit card drop down) and still be offered to autofill incorrectly
(You can optionally refresh the site at this point or even navigate to another domain with non credit card enabling drop downs and try them to see if they offer autofill incorrectly too. It doesn't even have to be a domain on https).
- Touch
#normalInput
(or any plain non credit-card text input) and the autofill is not visible as desired - Touch
#normalSelect
(or any non-credit card drop down on any) again and now autofill has gone
My question is, is there anything I can do (maybe apply something to select drop downs) to make sure it never offers credit card autofill?
Is this a known iOS bug?
I am using an iPhone6 iOS 8.1.2 Safari.
EDITS
- Textareas also have this issue.
- Adding
autocomplete="off"
does not prevent it.
来源:https://stackoverflow.com/questions/30599381/ios-credit-card-autofill-persists-on-drop-down-inputs