-
-
Save GitHub30/15133ce4375ccf6c7c8ac6fc9c44d64a to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/roqabuwuta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<textarea name="" id="" cols="30" rows="10">{"hello": "world"}</textarea> | |
<a download="hoge.json" onclick="doDownload(this)">download</a> | |
<script id="jsbin-javascript"> | |
function doDownload(a) { | |
var blob = new Blob( | |
[ JSON.stringify(JSON.parse(a.previousElementSibling.value), null, 2) ], | |
{ type : 'application/json' } | |
); | |
a.href = window.URL.createObjectURL(blob); | |
} | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function doDownload(a) { | |
var blob = new Blob( | |
[ JSON.stringify(JSON.parse(a.previousElementSibling.value), null, 2) ], | |
{ type : 'application/json' } | |
); | |
a.href = window.URL.createObjectURL(blob); | |
} | |
</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doDownload(a) { | |
var blob = new Blob( | |
[ JSON.stringify(JSON.parse(a.previousElementSibling.value), null, 2) ], | |
{ type : 'application/json' } | |
); | |
a.href = window.URL.createObjectURL(blob); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment