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
print-window-tiddler
Jeremy Ruston 2012-07-12 13:13:48 +01:00
rodzic 632c846ae0
commit 9404d670d3
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -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();
};
/*