1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-11 09:50:27 +00:00

Added download saver, our fallback based on standard HTML

It's clunky, and requires manual intervention to accomplish a save, but
it does work on Chrome, Safari, iOS mobile safari
This commit is contained in:
Jeremy Ruston 2012-07-12 13:13:48 +01:00
parent 632c846ae0
commit 9404d670d3

View File

@ -18,7 +18,16 @@ Select the appropriate saver module and set it up
var DownloadSaver = function() {
};
DownloadSaver.prototype.save = function() {
DownloadSaver.prototype.save = function(text) {
// Set up the link
var link = document.createElement("a");
link.setAttribute("target","_blank");
link.setAttribute("href","data:text/html," + encodeURIComponent(text));
// Use the download attribute to download it if it is supported
if(link.download !== undefined) {
link.setAttribute("download","tiddlywiki.html");
}
link.click();
};
/*