blob: 5bfbd75fb825fe62df1239839040b0f9b483ab9a [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<a download="suggested-filename" href="">link</a>
<!-- In addition to initiating a download using a Blob URL, the script below
will immediately revoke the URL as soon as the click() event has been
dispatched. This tests that, in addition to handling the blob URL, that
proper lifetime extensions are in place to prevent the blob from going away
before the download is complete. -->
<script>
var anchorElement = document.querySelector('a[download]');
var blob = new Blob(['hello world!'], {type: 'text/plain'});
var url = URL.createObjectURL(blob);
anchorElement.href = url;
anchorElement.click();
</script>
</body>
</html>