如何检查浏览器是否支持 HTML5 文件上传(FormData 对象)? [英] How can I check if the browser support HTML5 file upload (FormData object)?
本文介绍了如何检查浏览器是否支持 HTML5 文件上传(FormData 对象)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何查看浏览器是否支持 HTML5 文件上传(FormData 对象)?
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 supported
但正确的浏览器支持应该是,
But the correct browser support should be,
Firefox - supported
Chrome - supported
Opera - not supported
Safari - supported
IE9 - not supported
我已经在 Opera 上测试了 html 5 文件上传,它肯定不能工作.
I have tested the html 5 file upload on Opera and it is not working for sure.
我确定 safari 支持 html 5 文件上传.
I am sure that safari supports html 5 file upload.
推荐答案
尝试 if( window.FormData === undefined )
或 if( window.FormData !== undefined )代码>.
这篇关于如何检查浏览器是否支持 HTML5 文件上传(FormData 对象)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文