Chrome中的HTML5 DataTransfer检测错误 [英] HTML5 DataTransfer detection error in Chrome

查看:138
本文介绍了Chrome中的HTML5 DataTransfer检测错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Javascript检测DataTransfer对象中是否支持files属性。以下代码导致Chrome中出现Uncaught ReferenceError:DataTransfer未定义,但IE,Firefox和Safari都很好。

Trying to detect if files property is supported in DataTransfer Object using Javascript. The following code causes an "Uncaught ReferenceError: DataTransfer is not defined" in Chrome, but IE, Firefox and Safari are all fine.

我的代码是:

if ("files" in DataTransfer.prototype) {
    alert("supported");
}

知道为什么或另一种方法来确定是否支持files属性?

Any idea why or an alternative way to determine if the files property is supported?

谢谢

推荐答案

Chrome没有DataTransfer对象。它有Clipboard对象。

Chrome doesn't have a DataTransfer object. It has the Clipboard object.

这篇关于Chrome中的HTML5 DataTransfer检测错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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