文件输入对话框在Google Chrome中打开速度非常慢 [英] File input dialog opening very slowly in Google Chrome

查看:638
本文介绍了文件输入对话框在Google Chrome中打开速度非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有简单的上传文件的输入,只接受 .class 文件:

 < input type =fileaccept =。class> 

问题在于接受属性( accept =。class)导致对话框在Chrome中打开速度非常缓慢,有时甚至需要10秒,但在Mozilla Firefox和Internet Explorer中完美运行。我正在使用最新版本的Chrome - 53.0.2785.116 m(64位)。我觉得这很愚蠢,因为其他扩展在Chrome中也是完美的。我已经阅读了类似问题的其他问题,其中一些人建议添加名称属性可以解决这个问题,但在这种情况下不起作用。问题是很容易重现,您只需要我提供的代码行。

编辑:

Google今天发布了一个更新 - 53.0.2785.143 ,它似乎已经解决了这个问题。

解决方案

这是一个 52.0.2743.116 %20Pri%20M%20Stars%20ReleaseBlock%20Component%20Status%20Owner%20Summary%20OS%20Modified%rel =noreferrer $ c $。

临时解决方法是使用MIME类型并且是显式的(没有通配符)。 Ex取代:

< input type =filename =images []multiple =multipleaccept =image / * >



与:

<输入类型=文件名称=图像[]倍数=倍数接受=图像/ GIF,图像/ PNG,图像/ JPEG,图像/ BMP,图像/ WebP>



$ b

< input type = fileaccept =application / java-vm> 根据 mime类型列表

I have simple input for uploading files and it only accepts .class files:

<input type="file" accept=".class">

Problem is that accept property (accept=".class") causes dialog to open very slowly in Chrome, it sometimes takes even up to 10 seconds, but it works perfectly in Mozilla Firefox and Internet Explorer. I am using latest version of Chrome - 53.0.2785.116 m (64-bit). I find this really silly because other extensions work perfectly in Chrome as well. I have read other questions with similar problems, some of them suggested that adding name property may fix the problem, but it doesn't help in this case. Problem is really easy to reproduce, you only need the line of code I provided.

Edit:

Google published an update today - 53.0.2785.143 and it seems to have fixed the problem.

解决方案

This is a known regression bug in Chrome version 52.0.2743.116.

The temporary workaround is use mime type and be explicit (no wildcards). Ex replace:

<input type="file" name="images[]" multiple="multiple" accept="image/*">

with:

<input type="file" name="images[]" multiple="multiple" accept="image/gif, image/png, image/jpeg, image/bmp, image/webp">

To solve your specific problem this should work:

<input type="file" accept="application/java-vm"> per the mime types list

这篇关于文件输入对话框在Google Chrome中打开速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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