title: HTML5: drag out a JS generated file
body: <p>I have a feeling security concerns may not allow this but is it possible to generate a file with JavaScript and allow the user to drag it to the desktop (or file system)?</p>
  
  <p>The following code drags out a file from a server</p>
  
  <pre><code>files[0].addEventListener("dragstart",function(evt){
      evt.dataTransfer.setData("DownloadURL", "application/octet-stream:Eadui2.ttf:http://thecssninja.come/demo/gmail_dragout/Eadui.ttf");
  },false);
  </code></pre>
  
  <p>And with the below code I can generate a file and have it download but I can't set the file name or let the user select the location.</p>
  
  <pre><code>var uriContent = "data:application/octet-stream," + encodeURIComponent(JSON.stringify(map));
  location.href = uriContent;
  </code></pre>
  
  <p>Ideally I'd like a magical combination of both.</p>