[JS] save txt file

(function () {
    var blob = new Blob(['content'], {type: 'text/plain; charset=utf-8'}),
        blobUrl = URL.createObjectURL(blob),
        node = document.createElement('a');

    node.href = blobUrl;
    node.download = 'testSave.txt';

    node.click();
}());

 

posted @ 2016-04-11 10:16  薄荷君  阅读(363)  评论(0编辑  收藏  举报