iOS更新到10.3.1打破了HTML输入元素 [英] iOS update to 10.3.1 breaks HTML input element

查看:79
本文介绍了iOS更新到10.3.1打破了HTML输入元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个站点,该站点主要由该领域的iPad使用(不是大小适合在iPad上使用的应用程序),显然,刚刚发布的更新导致输入问题.我们有一个HTML输入,用于允许他们从保存的图片中进行选择:

We have a site that is used predominantly by iPads in the field (not an app, sized for use on iPad) and apparently an update that just came out is causing issues with input. We have an HTML input that used to allow them to select from saved pictures:

        <input class="fileInput" type="file" name="file" accept="image/*" capture>

现在,它仅打开相机,而没有使用胶卷的选项.这是别人看到的东西吗?有解决方法吗?

And now it only opens the camera without an option to use the roll. Is this something someone else has seen? Is there a workaround?

谢谢, 詹姆斯

推荐答案

由于您使用布尔属性capture,因此只能打开相机.根据 HTML Media Capture规范:

It only open camera because you use boolean attribute capture. According to HTML Media Capture specification:

capture ...(如果指定)表示首选使用媒体捕获机制从设备环境直接捕获媒体.指定capture属性后,用户代理应调用特定 capture控件类型的文件选择器.

The capture...if specified, indicates that the capture of media directly from the device's environment using a media capture mechanism is preferred. When the capture attribute is specified, the user agent should invoke a file picker of the specific capture control type.

在本规范中,术语捕获控件类型是指为用户优化的,专门用于直接捕获accept属性指定的MIME类型的媒体的文件选择器控件的特殊类型. ,使用媒体捕获机制.

In this specification, the term capture control type refers to a specialized type of a file picker control that is optimized, for the user, for directly capturing media of a MIME type specified by the accept attribute, using a media capture mechanism.

媒体捕获机制一词是指设备的本地媒体捕获设备,例如照相机或麦克风.

The term media capture mechanism refers to a device's local media capture device, such as a camera or microphone.

根据您的情况,根据

For your case, it is better to use <input> without capture, according to HTML specification, it seems offering option is a common browser behavior:

用户代理可以使用此属性的值(接受)来显示比通用文件选择器更合适的用户界面.例如,给定值image/*,用户代理可以为用户提供使用本地相机或从其照片集中选择照片的选项;

User agents may use the value of this attribute (accept) to display a more appropriate user interface than a generic file picker. For instance, given the value image/*, a user agent could offer the user the option of using a local camera or selecting a photograph from their photo collection;

先前已经有关于此文件输入控件"的讨论. 3年前的行为: HTML文件输入控件具有捕获和接受属性工作不正确?您会看到捕获属性存在时显示选项对话框".使人们感到困惑.

There is a previous discussion on this "file input control" behavior 3 years ago: HTML file input control with capture and accept attributes works wrong? You can see that "show option dialog when capture attribute exists" makes people confused.

我认为10.9.3中的iOS更改是文件输入控制的修复.否则,使用或不使用capture属性都不会有任何区别.

In my opinion, this iOS change in 10.3.1 is a fix for file input control. Otherwise, there would be no difference with or without capture attribute.

这篇关于iOS更新到10.3.1打破了HTML输入元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆