The following small series for everyone to bring a piece of the following small series for everyone to bring a quick solution input[type=file] Open slow, lag problem. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.
Why is it very slow to open a local folder when the input tag type is file-uploaded with a property accpet= "image/*"in the label?
The test found that safari, Firefox, and Chrome (which opera doesn't know why) are not stuck in the Mac.
In Windows, Firefox doesn't lag, only chrome.
So I decided to try to get rid of Accpet first ...
Sure enough, there is no problem of stalling.
Then this package in try accpet= "image/jpg" really also not Kaka!!
It seems that the problem is "image/*."
But the original intention of writing Accpet is to want to filter out all the pictures _ (: З"∠) _
So in order to achieve this requirement, and to improve the user experience, you can only take the enumeration
The modified code
<input type = "File" accpet= "Image/gif,image/png,image/jpeg,image/jpg,image/bmp"/>
Try again, it's all settled!
It turns out that Chrome's safebrowsing feature checks the file when it's uploaded or saved.
If the network is connected to Google faster, there is no problem.
But if the connection is slow, or if you simply kneel down, the safebrowsing will let Chrome hang up for a while until the file check is over or timed out
Using accept= "Image/png, Image/jpeg, image/gif" can solve this problem because these MIME types are in the safebrowsing Whitelist and do not need to be checked.
But if you use something like accept= "image/*" , it's not going to work, it could become Kaka.