How to Save a file at client side using JavaScript?

前端 未结 6 548
一生所求
一生所求 2020-12-11 06:44

I want to save a JSON object to a file at client to persist it for future usage, I have tried following line

window.open(\"data:text/json;charset=utf-8,\" + es

6条回答
  •  北海茫月
    2020-12-11 07:18

    FileSystem APIs is part of HTML5 spec and it is possible to access file system in a sandbox for a certain website in modern browsers, here is a good tutorial: http://www.html5rocks.com/en/tutorials/file/filesystem/

    However I would go with LocalStorage API for that matter which has better browser support: http://www.w3schools.com/html5/html5_webstorage.asp

提交回复
热议问题