我有简单的上传文件输入,它只接受 .class
文件:
<input type="file" accept=".class">
问题是 accept 属性 (accept=".class"
) 导致对话框在 Chrome 中打开非常慢,有时甚至需要长达 10 秒,但它在 Mozilla Firefox 和 Internet 中完美运行探索者。我使用的是最新版本的 Chrome - 53.0.2785.116 m(64 位)
。我觉得这真的很愚蠢,因为其他扩展在 Chrome 中也能完美运行。我读过其他有类似问题的问题,其中一些建议添加 name
属性可能会解决问题,但在这种情况下无济于事。问题很容易重现,只需要我提供的那行代码即可。
编辑:
Google 今天发布了一个更新 - 53.0.2785.143
,它似乎已经解决了这个问题。
最佳答案
这是一个 known regression bug在 Chrome 版本中 52.0.2743.116
.
临时解决方法是使用 mime 类型并且是显式的(无通配符)。例如替换:
<input type="file" name="images[]" multiple="multiple" accept="image/*">
与:
<input type="file" name="images[]" multiple="multiple" accept="image/gif, image/png, image/jpeg, image/bmp, image/webp">
要解决您的具体问题,这应该可行:
<input type="file" accept="application/java-vm">
根据 mime types list
关于html - 文件输入对话框在 Google Chrome 中打开速度非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39772671/