HTML5 Safari iOS只能访问相机而不是照片库 [英] HTML5 Safari iOS access only camera not photo library

查看:659
本文介绍了HTML5 Safari iOS只能访问相机而不是照片库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< input type =filecapture =cameraaccept =image / *> 允许移动浏览器拍照。在Android原生浏览器和Chrome上,单击输入按钮可立即启动相机。在iOS Safari上,该按钮会启动一个警告,要求拍照或从照片库中选择。如何立即启动原生相机?

<input type="file" capture="camera" accept="image/*"> allows a mobile browser to take a picture. On Android native browser and chrome, clicking the input button launches the camera instantly. On iOS Safari, the button launches an alert asking to "Take Photo" or choose from "Photo Library". How can I launch the native camera immediately?

推荐答案

此时在iOS上无法实现。

It's not possible on iOS at this time.

iOS6到10不支持 capture 属性,这意味着强制用户代理使用相机,不是照片库。

iOS6 through 10 do not support the capture attribute which is meant to force the user agent to use the camera, not the "Photo Library".

capture 属性是HTML Media Capture的一部分。

The capture attribute is part of HTML Media Capture.

PS:你可以用 capture capture =camera来改善你的代码$ C>。 2012年,在HTML媒体捕获中,捕获属性已从4个字符串更改为布尔值规格

PS: You could improve your code by replacing capture="camera" with just capture. In 2012 the capture attribute was changed from 4 strings to boolean in the HTML Media Capture spec.

这篇关于HTML5 Safari iOS只能访问相机而不是照片库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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