views:

36

answers:

1

Hi, I've seen many articles about dragging files INTO a browser, but none about dragging files FROM the browser to a windows application or the desktop/windows-explorer.

I'm looking for a cross-browser solution but IE8 is our main browser.

If I create a link in a web page and then drag that link from the page into Microsoft Word, it inserts a link. However, if that link is pointing at a PDF document, I would like it to embed the PDF doc inside the Word doc, as if I'd dragged it from Windows Explorer, into MS Word.

Is that possible?

I've even tried pointing the link at an ASP page which returns "application/pdf" data but I still just get a link in my word doc so I suspect that links are the wrong way to go.

Thanks for any help!

A: 

I suspect you'll find that it is indeed not possible. The behavior upon drop is determined by the "receiving" application, not the "sending" application. As you point out, Word creates links to things that are dropped on it. The browser doesn't have any control over that.

Mark
The crazy thing is that I have Word 2007 and if I use the "Insert Object" button on the toolbar and then supply a URL instead of a local file, it inserts the object perfectly! Recognises it as a PDF. No problem. I'm wondering if there's another way to represent the PDF file (or other types of file) in the HTML that tells word to embed the object rather than the link.
jqwha
There's not. To Word, you dragged/dropped a link. The fact that Word has an "Insert Object" button shows you that the handling of the dropped link is entirely controlled by the "dropped onto" application.
Mark
I agree. I'm wondering if there's another way to represent the PDF file (or other types of file) in the HTML that tells word to embed the object rather than the link...
jqwha
Interestingly, if I drag and drop an image from IE8 to Word, it inserts the image. If I drag the SAME image from Firefox to Word, it inserts a link. Why, if Word is controlling the accepted link, is there a difference? Weird.
jqwha
The difference would be in "what got dropped". The "dragged-from" application decides WHAT is being dragged... whether it's a link or an image, it gets to decide. The receiving application gets to decide what to do with whatever got dropped. In no case would a "file" get dragged when you dragged a link out of a browser. That'd be a pretty giant security problem.
Mark
This seems inconsistent. The only thing I can control is "what got dragged" via the "dragged from" browser. Since different browsers appear to deliver different objects from the same page/operation, my question is how, if at all, do I control the supplied entity so that it responds desirably in the target application? There's no point discounting it as impossible when it plainly happens from one browser. I'm aware that "files" are not dropped, however references TO files ARE dropped, just in differing ways. Thanks.
jqwha