问题
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.
My code is:
if ("files" in DataTransfer.prototype) {
alert("supported");
}
Any idea why or an alternative way to determine if the files property is supported?
Thanks
回答1:
Chrome doesn't have a DataTransfer object. It has the Clipboard object.
来源:https://stackoverflow.com/questions/3828183/html5-datatransfer-detection-error-in-chrome