本文介绍了我如何检查浏览器是否支持HTML5文件上传(FormData对象)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b
/ code>。How can I check if the browser support HTML5 file upload (FormData object)?
var fd = new FormData();Following the answer from this post, but the code does not return correct answer about the browser,
window.onload = function() { if (!!window.FileReader) { alert('supported'); } else { alert('not supported'); } } Firefox - supported Chrome - supported Opera - supported Safari - not supported IE9 - not supportedBut the correct browser support should be,
Firefox - supported Chrome - supported Opera - not supported Safari - supported IE9 - not supportedI have tested the html 5 file upload on Opera and it is not working for sure.
I am sure that safari supports html 5 file upload.
解决方案Try if( window.FormData === undefined ) or if( window.FormData !== undefined ).
这篇关于我如何检查浏览器是否支持HTML5文件上传(FormData对象)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!