File input dialog opening very slowly in Google Ch

2019-05-28 16:04发布

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.

1条回答
Deceive 欺骗
2楼-- · 2019-05-28 16:23

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

查看更多
登录 后发表回答