blob: 55ff0c0668e80ccddc26e719edb1327635a412f5 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<a id="href" href="simple.html">download</a>
<script>
var element = document.getElementById("href");
var data = { x: 42, s: "hello, world" };
var json = JSON.stringify(data);
var blob = new Blob([json], {type: "octet/stream"});
var url = window.URL.createObjectURL(blob);
element.href = url;
element.click();
</script>
</body>
</html>