Why is it that when the input tag type is file and the attribute accpet="image/*" is set in the tag, the speed of opening the local folder is particularly slow? After testing, I found that there is no lag problem in Safari, Firefox, and Chrome (Opera always crashes for some reason) on Mac. In Windows, Firefox does not lag, only Chrome lags. So I decided to remove accpet first... Sure enough, there was no lag problem. Then this package tried accpet="image/jpg" and it really didn't get stuck! ! It seems that the problem is "image/*" But the original intention of writing accpet was to filter out all the pictures_(:з」∠)_ In order to achieve this requirement and improve user experience, we can only use enumeration. Modified code <input type="file" accpet="image/gif,image/png,image/jpeg,image/jpg,image/bmp"/> Try it again, and it works fine! It turns out that this is because Chrome's SafeBrowsing feature checks files when uploading or saving. If the network connection to Google is fast, there will be no problem. But if the connection is slow or down, SafeBrowsing will hang Chrome for a while until the file check is completed or times 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 won't work and it may become stuck. The above article on how to quickly solve the problem of slow and stuck opening of input[type=file] is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. |
<<: RHCE installs Apache and accesses IP with a browser
>>: How to strike a balance between ease of use and security in the login interface
Table of contents Why understand the life cycle W...
Environment Preparation 1. Environment Constructi...
In the previous article, I introduced the basic k...
Brief Description This is a CSS3 cool 3D cube pre...
Limit usage When we use query statements, we ofte...
Table of contents 2. Tried methods 2.1 keep-alive...
Regarding the issue of MySQL remote connection, w...
Beginners can learn HTML by understanding some HT...
Join query A join query refers to a matching quer...
Table of contents 1. Eclipse configures Tomcat 2....
All previous projects were deployed in the Window...
Table of contents Nginx load balancing configurat...
Achieve results Implementation Code <h1>123...
Public free STUN servers When the SIP terminal us...
Socket option function Function: Methods used to ...