My problem:
然后用户点击input type=file
,用户必须得到upload file + camera
对话框.我为该html使用的是属性accept
和capture
.但在一些现代设备上,这种情况不会发生.下面是代码示例和它的工作与否的表格.代码示例在Mobile Safari
和Chrome
中进行了测试.
TL;DR:个
我有5个代码示例,其中只有input type file
个:
1.(100)
<input type="file" accept="image/*" capture>
2. (100)
<input type="file" accept="image/*" capture="camera">
3. (100)
<input type="file" capture="camera">
4. (100)
<input type="file" capture>
5. (100)
<input type="file" accept="image/*">
测试设备:
- 三星S3(Android 4.1.2)
- 三星S3(Android 4.3)
- 三星Galaxy Tab 2 7.0(Android 4.2.2)
- 三星Note(Android 4.1.2)
- iPhone 5(iOS 7.0.4)
- Nexus 4(Android 4.4)
结果表:
- W(工作)-意味着启用
upload image dialog with camera
- P(艺术作品)-平均启用
upload dialog(not image only) with camera
- N(非工作)-启用手段
only camera
- CH-均值为
Chrome
- MS-表示
Mobile Safari
#
--------------------------------------------------------------------------------
|devices/example | Ch 1| Ch 2| Ch 3| Ch 4| Ch 5| MS 1| MS 2| MS 3| MS 4| MS 5|
--------------------------------------------------------------------------------
|Samsung S3/4.1 | N | N | P | P | W | W | N | P | P | W |
--------------------------------------------------------------------------------
|Samsung S3/4.3 | N | N | P | P | P | N | N | P | P | P |
--------------------------------------------------------------------------------
|Samsung Galaxy Tab| N | N | P | P | W | W | N | P | P | W |
--------------------------------------------------------------------------------
|Samsung Note | N | N | P | P | W | W | N | P | P | W |
--------------------------------------------------------------------------------
|iPhone 5 | W | W | P | P | W | W | Y | P | P | W |
--------------------------------------------------------------------------------
|Nexus 4 | N | N | P | P | W | - | - | - | - | - |
--------------------------------------------------------------------------------
如你所见,我在所有浏览器上只能看到upload file + camera
个对话框
<input type="file" accept="image/*">
元.但在这个例子中没有capture
属性,这让我很担心,安卓4.3也有一个问题.
我的问题是:
- 表中的行为是否为真?Android 4.3的行为是错误吗?
- 我能相信浏览器总是会添加摄像头来上传吗
谢谢
附注.问题是特殊的,但在我的网站上,我必须提供给用户访问其图像和相机.另外,我认为我的桌子对任何人都有帮助,如果没有人回答,我也会寻找答案,并在这里发布我的答案.