<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3395" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009>Sounds interesting!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009>You only mention a singular file, what do you think
about multiple files?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009>Also, would it be possible to hook browser-produced
data into this model, so client-generated data (f ex text, html, pdf) could be
dragged out as a virtual file to the desktop?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009>Best regards</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Verdana color=#0000ff size=2><SPAN
class=011562408-18082009>Mike Wilson</SPAN></FONT></DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> whatwg-bounces@lists.whatwg.org
[mailto:whatwg-bounces@lists.whatwg.org] <B>On Behalf Of </B>Jian
Li<BR><B>Sent:</B> den 18 augusti 2009 03:03<BR><B>To:</B>
whatwg@lists.whatwg.org<BR><B>Subject:</B> [whatwg] Proposal to drag virtual
file out of browser<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>SUMMARY</DIV>
<DIV><BR></DIV>
<DIV>The HTML 5 spec defines the event-based drag-and-drop mechanism that
could cross the browser boundary. If a draggable element contains a URL,
dragging it out of the browser will only copy the URL value. However, in some
scenarios, we really want to download the data file from the specified URL,
instead of copying the value. Here we propose a way to allow dragging a
virtual file denoted by an URL out of the browser boundary.</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=Apple-style-span style="BORDER-COLLAPSE: collapse">USE
CASES</SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse"><BR></SPAN></DIV>
<DIV><SPAN class=Apple-style-span style="BORDER-COLLAPSE: collapse">In order
to download the attachment from an Internet mail application, the user will
have to click the attachment link and a "save" dialog will pop up to let the
user select the destination folder. This will normally involves multiple
clicks. Native application, like Outlook, can let the user drag
attachments directly into the destination place, i.e. desktop, which is
really convenient. </SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse"><BR></SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse">WORKAROUNDS</SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse"><BR></SPAN></DIV>
<DIV><SPAN class=Apple-style-span style="BORDER-COLLAPSE: collapse">Currently
there is no direct support in HTML 5 to support such dragging of the virtual
file. To work around this, a plugin with such capability has to be installed
and used.</SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse"><BR></SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse">PROPOSAL</SPAN></DIV>
<DIV><SPAN class=Apple-style-span
style="BORDER-COLLAPSE: collapse"><BR></SPAN></DIV>
<DIV><SPAN class=Apple-style-span style="BORDER-COLLAPSE: collapse">
<DIV>We propose adding a specific format string to the DataTransfer object:
"DownloadURL". The data associated with the "DownloadURL" format should be
parsed similar to the "URL" format. When the drag ends in another application,
the remote file described in the associated data URL should be downloaded and
provided to the target application.</DIV>
<DIV><BR></DIV>
<DIV>For example, here's how one can create a draggable image that results in
a file when dragged:</DIV>
<DIV><BR></DIV>
<DIV>var dragTarget = document.createElement("img");</DIV>
<DIV>dragTarget.src = "<A
href="http://example.com/example-attachment.gif">http://example.com/example-attachment.gif</A>";</DIV>
<DIV>document.body.insertBefore(dragTarget, document.body.firstChild);</DIV>
<DIV>dragTarget.addEventListener("dragstart", function(event) {</DIV>
<DIV> event.dataTransfer.setData("DownloadURL", "<A
href="http://example.com/example-download-attachment">http://example.com/example-download-attachment</A>");</DIV>
<DIV>}, false);</DIV>
<DIV><BR></DIV>
<DIV>
<DIV>Traditionally allowing the non-image file to be dragged out of the
browser is considered bad. The main danger here is that the user might
unknowingly drag a file that will auto-execute. To address this issue, the
browser needs to mark the dragged file to indicate that it is coming from the
Internet. With this zone marker, the user will be prompted with a security
warning dialog when the dropped file is launched. If a specific platform does
not support zone identifier marker, this feature should be turned off by
default.</DIV>
<DIV><BR></DIV>
<DIV>We should consider allowing only http and https typed URL in the
associated data for the "DownloadURL" format. Should we further restrict the
download URL to the same origin?</DIV>
<DIV><BR></DIV>
<DIV>If the filename is provided in the Content-Disposition header, it should
always be used. Otherwise, it is up to the browser to decide how the filename
is generated from the URL. But once it is chosen, it cannot be changed.</DIV>
<DIV><BR></DIV>
<DIV>The drag-and-drop feedback might be decorated with the filename and the
domain from which the file is downloaded. However, the real filename might be
only available when we initiate the download and get back the response header.
To address this, we can download the response header after the drag is
initiated and then update the feedback image based on the filename retrieved
from the Content-Disposition header. This might not be possible for certain
platform because changing the drag meta-data might not be allowed.</DIV>
<DIV><BR></DIV></DIV></SPAN></DIV></BLOCKQUOTE></BODY></HTML>