测试浏览器是否支持多个文件上传? [英] Testing if a browser supports multiple file uploads?

查看:143
本文介绍了测试浏览器是否支持多个文件上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法测试某个浏览器是否支持文件上传元素的多个属性?服务器端或客户端实现就足够了。

Is there a way to test if a given browser supports the multiple attribute on file upload elements? Either a server-side or client-side implementation is sufficient.

我确实知道我可以针对支持该功能的已知浏览器列表测试用户代理,但是这似乎是一个相当脆弱的实现(即如果IE 10最终启动时支持该功能,我将不得不编辑我的代码)。我更愿意直接测试该功能的支持。

I do realize I can test the user-agent against a list of known browsers that support the feature, but that seems like a rather frail implementation (ie. if IE 10 supports the feature when it finally launches, the I'll have to go edit back my code). I'd prefer to test support of the feature directly.

想法?

推荐答案

我建议在document.createElement(input)中使用multiple进行特征检测。

I'd recommend using "multiple" in document.createElement("input") for feature detection.

这篇关于测试浏览器是否支持多个文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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