When is the Scan Credit Card option available on iOS8 Safari?

前端 未结 9 936
情深已故
情深已故 2020-11-29 16:06

So Safari offers Scan Credit Card feature on iOS8 with some credit card forms.

My question is, how does Safari determine when to offer this option?<

9条回答
  •  北荒
    北荒 (楼主)
    2020-11-29 16:29

    I think your better bet is to use HTML5 Autocomplete Types on your inputs.

    Stick to the credit card related types, and most modern browsers will auto recognize these fields for you, including Mobile Safari and the "Scan Credit Card" feature. Bonus is that you'll always get the correct keyboard on mobile devices too.

    Example (note autocomplete, x-autocompletetype, and pattern attributes):

    
    
    
    

    I also wrote a related blog post on this topic and built an HTML5 Autocomplete Cheatsheet.

提交回复
热议问题