mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-01-11 18:00:26 +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:
parent
632c846ae0
commit
9404d670d3
@ -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();
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user