Reputation: 95
Is there a way to drag a file from a custom made webpage, hosted on a local maching, onto a piece of software?
Example use:
For the sake of the question, I want to drag an .mb file from an html library I have created onto Maya. Ideally this will act as if I have dragged a file from finder or windows explorer. I know you can drag and drop onto a browser using HTML5 but I am trying to achieve the reverse.
Any suggestions would be greatly appreciated.
Regards
Upvotes: 6
Views: 2264
Reputation: 3826
Yes, it is possible. you can go through this link which has explained how to achieve drag and drop from Browser to desktop in details.
The solution only works with Chrome browser as Google has extended the ability to drag out attachments to your file system. (Probably for their Google drive)
It can be achieved by calling "ondragstart" event like the code below on the file that you wish to be dragged from Browser to the client machine:
var file = document.getElementById("dragout");
file.addEventListener("dragstart",function(evt){
evt.dataTransfer.setData("DownloadURL",fileDetails);
},false);
Upvotes: 6