【问题标题】:Mobile Safari, Chrome crashes when upload pictures from camera从相机上传图片时,移动 Safari、Chrome 崩溃
【发布时间】:2017-11-18 23:21:05
【问题描述】:

我有最简单的页面:<input type='file' accept='image/*'> 列表。

什么时候做以下最简单的情况:
- 点击“上传”-> 从相机拍照 -> 批准。
- 对所有输入控制重复此操作。(在下面的代码中为 12)
- 比我再做一次,在〜第 15 次“上传”页面崩溃并重新加载。

如果重新启动进程,页面在 4-5 次“上传”后崩溃。最后,即使在第一张图片上传后,我也可以崩溃页面。

针对 iPhone 6+ IOS 10 描述了该错误。

但我在iPhone 6S+ IOS 10上重现(但只需要更多的迭代, Iphone 6 IOS 10Android Chrome 58.0.3029

但适用于 iOS 9.5.3

Index.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .file-style {
            width: 20em;  height: 2em;
        }
    </style>
</head>
<body>

<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>
<input type='file' accept='image/*' class="file-style"><br>

<script>

</script>
</body>
</html>

附言。在实际场景中,我在 react+redux 上有 SPA,上传 4-6 图片。上传第 4、5 张图片后失败。

【问题讨论】:

    标签: android html ios google-chrome mobile-safari


    【解决方案1】:

    唯一的解决方法是不要将accept='image/*' 用于这些有缺陷的浏览器(或根本不使用)。

    请注意,使用image/gif, image/jpg, image/jpeg, image/png 也不能解决您的问题。

    最后,如果移动支持是您的目标之一,请理解 accept 并未得到广泛支持:https://caniuse.com/#search=accept

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-04-02
      • 2014-02-05
      • 1970-01-01
      • 1970-01-01
      • 2019-08-30
      • 1970-01-01
      • 2012-08-03
      相关资源
      最近更新 更多