简体   繁体   English

iOS Safari(iPhone SE)自动完成不工作 HTML5 自动完成属性添加

[英]iOS Safari (iPhone SE) auto complete not working HTML5 autocomplete attributes added

We have a web form, and using the tips from iOS Safari Autofill / autocomplete sections not working however the current iOS doesn't work on the codepen here: https://codepen.io/grigs/pen/YqoyWv We have a web form, and using the tips from iOS Safari Autofill / autocomplete sections not working however the current iOS doesn't work on the codepen here: https://codepen.io/grigs/pen/YqoyWv

Is there any definitive way to get auto complete to work on iOS Safari?是否有任何明确的方法可以自动完成 iOS Safari?

And example input field is:示例输入字段是:

<div class="form-group">
   <label class="font-weight-bold input-label" for="FirstName">First name * <span class="field-validation-valid field-validation-valid" data-valmsg-for="FirstName" data-valmsg-replace="true"></span></label>
   <input type="text" class="form-control input input-about-you" data-val="true" data-val-required="Please enter your first name(s)" autocomplete="given-name" id="FirstName" name="FirstName" value="">
</div>

Every other browser respects the HTML5 autocomplete hints, except iOS Safari it seems - so would be great to get it working.所有其他浏览器都尊重 HTML5 自动完成提示,除了 iOS Safari 似乎 - 所以让它工作会很棒。

The exact phone we're struggling with is and iPhone SE MX9R2B/A - so an iPhone SE 2020. I'm sure it may affect other iOS with Safari.我们正在苦苦挣扎的确切手机是 iPhone SE MX9R2B/A - 所以是 iPhone SE 2020。我确信它可能会影响其他 iOS 和 Safari。

The codepen example seems correct, I just tested on iPhone SE 2nd generation - iOS14.4 Emulator codepen 示例似乎是正确的,我刚刚在iPhone SE 2nd generation - iOS14.4 Emulator 上进行了测试

SE2020 - Example SE2020 - 示例

The trick you might be missing is enabling AutoFill on Safari mobile to do this go to: Settings > AutoFill > toggle Use contact info/Credit Cards (if desired)您可能缺少的技巧是在 Safari 移动设备上启用AutoFill来执行此操作 go 到: Settings > AutoFill > toggle Use contact info/Credit Cards (如果需要)

You might also refeer to this guide Safari's strange behavior it's from 2016 but there explains a lot of the autofill behaviour.您也可以参考本指南Safari 的奇怪行为,它来自 2016 年,但其中解释了很多自动填充行为。

YOU ARE DOING WRONG.你做错了。 HERE IS A RIGHT WAY FOR HTML5 AUTOCOMPLETE这是 HTML5 自动完成的正确方法

<form autocomplete="on">
    <label for="fname">First Name:</label>
    <input type="text" id="firstname" name="firstname">
</form>

HOPE THIS ANSWER WILL HELP YOU.希望这个答案对您有所帮助。

LEARN MORE ABOUT AUTOCOMPLETE: https://www.w3schools.com/tags/att_input_autocomplete.asp了解有关自动完成的更多信息: https://www.w3schools.com/tags/att_input_autocomplete.asp

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM