1. 程式人生 > >input 文件上傳標簽響應很慢問題解決

input 文件上傳標簽響應很慢問題解決

input 上傳文件 延遲 webkit

<input type="file" accept="image/*">

當input的accept屬性值為image/*時,谷歌下點擊上傳文件需要等幾秒鐘才會出現,ie下卻沒有這個問題。

經查找參考http://www.tuicool.com/articles/vYfYVnf , 發現是input的accept屬性與Webkit瀏覽器引發的問題。解決方案為修改accept為指定類型:

<input type="file" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg">

再次測試仍出現文件選擇框延遲出現的現象 , 經測試是由於 image/svg標簽引起的, 去掉image/svg標簽就可以了。


原因分析: 沒搞懂 = = 。


最終方案:

<input type="file" accept="image/gif,image/jpeg,image/jpg,image/png">


本文出自 “陳安一” 博客,請務必保留此出處http://dabaozi.blog.51cto.com/8032088/1928585

input 文件上傳標簽響應很慢問題解決