2

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

guowy
  • 239
  • 2
  • 16
  • I am having the same issue and trying to find solution but no luck so far :(. Waiting for answers. http://stackoverflow.com/questions/2311887/how-to-determine-presence-of-html5-dragndrop-file-upload-api-like-the-one-from this is the earlier thread which elaborated this. – Anil Namde Jan 27 '11 at 08:08
  • i am surprised how this code is working with IE and Safari even. I have tested this code and got error on IE 8-9, Safari 5 and also on Chrome 8. Not sure how u got it working on the other browsers though ? Am i missing something ? – Anil Namde Feb 03 '11 at 13:07

1 Answers1

3

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

manixrock
  • 2,533
  • 4
  • 24
  • 29