At one point the W3C File API included a saveAs
method which allows you to save files to a users local file system using javascript.
The saveAs
part of the File API has now been removed by browsers for very good security reasons.
Eli Grey has coded a nice plugin that allows you to download files (like your points file) to a users local filesystem. The user must confirm that they want the downloaded file before it's saved to their filesystem. Again, this is for very good security reasons.
The FileSaver plugin: https://github.com/eligrey/FileSaver.js/
You might also check out Juhana's suggestion of using web storage
(also known as localstorage
) to store your points data to a "sandboxed" storage area. The storage area is located on the users local filesystem, but access is restricted to your web page only--"sandboxed". Localstorage does not require a user to confirm the save.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…