Kay
Kay

Reputation: 2854

html5 href download attribute issue

Until today this was working on Chrome to generate a KML file client-side:

<script>
  var kmlText = 'kml code here';
  var link = document.createElement("a");
  link.setAttribute("href", 'data:text/plain,' + kmlText);
  link.setAttribute("download", "Export.kml");
  link.innerHTML = "Download KML";
  document.getElementById("myDIV").appendChild(link);
</script>

<html>
  <div id="myDIV">Download</div>
</html>

Since recently the link would force a download but wouldn't accept the filename and extension on Chrome, defaulting to 'Download.txt'.. On Firefox it is working properly, as it was before on Chrome, too..

Here's a fiddle

Does someone have a clue?

Upvotes: 1

Views: 810

Answers (1)

lovasoa
lovasoa

Reputation: 6855

It looks like a bug in chrome. I can't reproduce it on my desktop.

You should file a bug here: https://code.google.com/p/chromium/issues/list

Upvotes: 3

Related Questions