4

Why can't I download files created with createObjectUrl in an Android app with a webview. It's also not possible with the default browser (Samsung Galaxy S6 Edge). I get the message (in Swedish) "Endast http- eller https-URL:er kan hämtas.", translation: only http or https URLs can be fetched.

HTML

<textarea id="editor">Hello, world!</textarea>
<a download="myFile.txt" id="fileSaver">Save as...</a>

Javascript

function updateLink() {
  var editor = document.getElementById("editor"),
    fileSaver = document.getElementById("fileSaver"),
    blob = new Blob([editor.value], { type: "text/plain" });

  fileSaver.href = (window.URL || window.webkitURL).createObjectURL(blob);
}
updateLink();
fileSaver.onclick = fileSaver.oncontextmenu = updateLink;

JSFiddle: http://jsfiddle.net/no3cLwpv/1/

n1stre
  • 5,856
  • 4
  • 20
  • 41
FlaxHaxx
  • 41
  • 2
  • Hi, have you ever solved this issue? I'm havng a similar one - javascript doesn't run on the Samsung Internet browser... Greets – Aleksandra Chuprova Mar 28 '16 at 17:55
  • We're having the same issue on Samsung Internet for Android 4 to be very specific. It works as expected on Chrome and stock Android browser, when run on the same phone. Not sure if any one found a solve for this yet? The exact message in English is "Only HTTP or HTTPS Web Addresses can be downloaded" – eriben Aug 27 '16 at 03:21

0 Answers0