本文介绍了iOS8 Safari上何时提供Scan Credit Card选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以Safari在iOS8上提供扫描信用卡功能,并提供一些信用卡表格。

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

我的问题是,Safari是如何运作的?确定何时提供此选项?

到目前为止,我发现此选项在亚马逊和PayPal上可用,但我的信用卡输入表单都没有重现此行为。

So far I found that this option is available on Amazon and PayPal, but none of my credit card input forms were able to reproduce this behaviour.

推荐答案

经过对iOS8浏览器和Chrome仿真的一些研究后,我发现了部分内容。我知道一些解决方案,但我不确定是否有其他方法可以做到这一点。你不得不感谢Apple在这方面缺乏文档。

After a bit of research with an iOS8 browser and Chrome emulation I figured it out partially. I know of some solutions, but I don't know for sure if there are other ways to do it. You'll have to thank Apple for the amazing lack of documentation around this.

目前Netflix /亚马逊的信用卡扫描工作正常。所以我在Chrome浏览器中模拟了一个iOS8用户代理,并检查了他们的信用卡号码字段的标记。这是Netflix的:

Currently Netflix/Amazon have credit card scanning working properly. So I emulated an iOS8 user agent in my Chrome browser and inspected the markup of their credit card number field. Here's Netflix's:

<input name="cardNumber" smopname="num" id="cardNumber-CC" class="cardNumber" type="text" value="************0891" pattern="[0-9]*">

这里是亚马逊的:

<input name="addCreditCardNumber" size="20" maxlength="20">

此时我玩了一个通过HTTPS服务的表单,我控制了它并开始设置属性看看会发生什么。下面,工作表示成功触发卡扫描,不工作表示执行触发卡扫描:

At that point I played around with a form served over HTTPS that I had control over and started setting attributes to see what would happen. Below, "works" means "successfully triggered card scan" and "doesn't work" means "did not trigger card scan":


  • name =addCreditCardNumber =>作品

  • name =cardNumber =>作品

  • name =cardnumber =>作品

  • class =cardNumber =>不起作用

  • type =cardNumber =>不起作用

  • id =cardNumber id =creditCardNumber id =creditCardMonth id =creditCardYear => works

  • name="addCreditCardNumber" => works
  • name="cardNumber" => works
  • name="cardnumber" => works
  • class="cardNumber" => does not work
  • type="cardNumber" => does not work
  • id="cardNumber", id="creditCardNumber", id="creditCardMonth", id="creditCardYear" => works

由于 name 属性驱动表单数据并可能影响服务器端的方式表格处理工作我强烈建议您通过将输入 id 设置为 cardNumber 来触发信用卡扫描。

Since the name attribute drives form data and might impact the way server-side form processing works I highly recommend triggering credit card scan by setting your input id to cardNumber.

我会链接到相关文档......但是嘿! none (至少,我不知道)

I would link to the relevant documentation...but hey! There's none (at least, not that I know of)

这篇关于iOS8 Safari上何时提供Scan Credit Card选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-11 14:01