See screenshot. Unless maybe this is a feature? I don't see how one would upload files while dragging the tag though.
Description
Related Objects
Event Timeline
From what I can tell, it seems like this is possible, but very complicated.
When the user drags something into the window, we aren't allowed to see what it actually is until they drop it (I think for security reasons, so websites can't see your data if you just wave files over them).
We can access dataTransfer.types to try to figure out what they're dropping, but this property is ridiculous:
On Cursor | Browser | OS | Types |
---|---|---|---|
Text File | Safari | OSX Yosemite | ["public.file-url", "CorePasteboardFlavorType 0x6675726C", "dyn.ah62d4rv4gu8y6y4grf0gn5xbrzw1gydcr7u1e3cytf2gn", "text/uri-list", "Files", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "com.apple.finder.node"] |
URL | Safari | OSX Yosemite | ["dyn.ah62d4rv4gu8zs3pcnzme2641rf4guzdmsv0gn64uqm10c6xenv61a3k", "WebURLsWithTitlesPboardType", "dyn.ah62d4rv4gu8yc6durvwwaznwmuuha2pxsvw0e55bsmwca7d3sbwu", "text/uri-list", "public.url", "CorePasteboardFlavorType 0x75726C20", "public.url-name", "CorePasteboardFlavorType 0x75726C6E", "public.utf8-plain-text", "text/plain"] |
Image | Firefox | OSX Yosemite | ["application/x-moz-file", "Files"] |
URL | Firefox | OSX Yosemite | [ "text/x-moz-url", "text/x-moz-url-data", "text/x-moz-url-desc", "text/uri-list", "text/_moz_htmlcontext", "text/_moz_htmlinfo", "text/html", "text/plain" ] |
Text File | Chrome | OSX Yosmemite | ["Files"] |
URL | Chrome | OSX Yosemite | ["text/plain", "text/uri-list", "text/html"] |
Possibly we can find some library which already deals with this mess; otherwise we need to enumerate a zillion browser/OS/file type combinations and come up with ways to detect files vs URLs vs whatever else.
Oh dang, that's gross.
As an alternative, could probably just make the elements undraggable? I think that's easy to do, and I doubt people get much utility out of dragging = various URL's around the page.
That being said, it's not like the current behavior is really causing problems, so this might not be worth the effort.
You can grab URLs from all over the place in lots of browsers (url bar, bookmark bar, tabs, etc).
T7129 is very similar and discusses another type of non-file resource which users can drag and drop.
I was hoping to have some time to play around with this a little more. Firefox and Chrome on Windows 8.1 looks more or less the same as your results.
Bookmark looks more or less like a normal URL except I'm getting x-moz-place for it in Firefox. I presume that stuff like tabs, bookmarks, etc. will be similarly unique on all browsers.
On cursor | Browser | OS | Types |
URL Bookmark | Firefox 36.0 | Windows 8.1 | text/html text/plain text/x-moz-url text/x-moz-place |
Tab | Firefox 36.0 | Windows 8.1 | application/x-moz-tabbrowser-tab |
Zip from 7Zip Dialog | Firefox 36.0 | Windows 8.1 | application/x-moz-file text/x-moz-url Files |
Zip from Windows Explorer Dialog | Firefox 36.0 | Windows 8.1 | Doesn't work |
URL Bookmark | Chrome 40.0 | Windows 8.1 | text/plain text/uri-list |
Tab | Chrome 40.0 | Windows 8.1 | Tabs detach when dragged |
Zip from 7Zip Dialog | Chrome 40.0 | Windows 8.1 | Files |
Zip from Windows Explorer Dialog | Chrome 40.0 | Windows 8.1 | Doesn't work |
Just using a hack of scripts from the W3.org Drag and Drop article and google searching.
EDIT: Doesn't work also means I get no type.
T8077 is similar issue but for images drug in, though we shouldn't be trying to convert images if we don't know if it's a file (and filling logs)