Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drag and Drop *FROM* a browser?

Dragging items into a browser is pretty well documented, and HTML5 makes this easier.

However, I'm wondering if and how it's possible to drag 'n' drop out of a browser.

In this scenario, you'd have a webpage element (eg. an anchor) that the user would click & drag OUT of the browser onto a drop target, and the browser would send the linked object (eg. an href'd file) directly to the drop target instead of starting the usual download.

Does anyone know if this is possible?

like image 747
dlchambers Avatar asked Nov 08 '12 18:11

dlchambers


People also ask

How do I drag and drop from a website?

Most modern web browsers have implemented native drag-and-drop based on the HTML5 spec. By default, only image and text can be draggable. To drag an image, you simply hold the mouse button down and then move it. To drag the text, you need to highlight some text and drag it in the same way as you would drag an image.

Can I use HTML drag and drop API?

In HTML, any element can be dragged and dropped.

How do you drag and drop text in HTML?

HTML Drag and Drop (DnD) is a feature of HTML5. It is a powerful user interface concept which is used to copy, reorder and delete items with the help of mouse. You can hold the mouse button down over an element and drag it to another location. If you want to drop the element there, just release the mouse button.


2 Answers

The very thing you are trying to do can be found here: https://ryanseddon.com/html5/gmail-dragout/.

This is an explanation for how to drag an anchor tag to the desktop, and the file will be downloaded there. (Or drag the anchor tag onto another application, and the OS will treat it appropriately.)

What I haven't figured out yet, is how to drag-and-drop multiple links (instead of only one at a time) via HTML5, without having to resort to an external resource library like jquery.

like image 103
Kenneth Brobst Avatar answered Sep 16 '22 17:09

Kenneth Brobst


Conceptually Yes, this is possible. But it would be the OS/application handling the drop to decide what to do with it. In fact you can do exactly what you describe with chrome. Open a new chrome window and drag a link to it. It navigates there. Drag a link to your desktop. In Win7 it creates a shortcut/link to that page.

What you are talking about is not HTML drag and drop but actually at an OS/application level. And would have to be handled with an application language, not the browser HTML.

like image 43
invertedSpear Avatar answered Sep 16 '22 17:09

invertedSpear