我如何检查浏览器是否支持HTML5文件上传(FormData对象)? [英] How can I check if the browser support HTML5 file upload (FormData object)?

查看:549
本文介绍了我如何检查浏览器是否支持HTML5文件上传(FormData对象)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


$ b

  var fd = new FormData()如何检查浏览器是否支持HTML5文件上传(FormData对象)? ; 

post ,但代码不会返回有关浏览器的正确答案,



<$ p $ ($ window.FileReader)
{
alert('supported');
}
else
{
alert('not supported');



$ b Firefox支持
支持Chrome浏览器
Opera支持
Safari浏览器 - 不支持
IE9 - 不支持

但是正确的浏览器支持应该是,

  Firefox  - 支持
Chrome - 支持
Opera - 不支持
Safari - 支持
IE9 - 不支持

我已经在 Opera 上测试了html 5文件上传,它是没有肯定工作。



我相信 safari 支持HTML 5文件上传。

解决if(window.FormData === undefined)或 if(window.FormData!== undefined) / 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 supported

But the correct browser support should be,

Firefox - supported
Chrome - supported
Opera - not supported
Safari - supported
IE9 - not supported

I 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对象)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆