Only use the download saver when the download attribute is supported

print-window-tiddler
Jeremy Ruston 2012-11-16 19:31:32 +00:00
rodzic 80bd198908
commit a4d88769b9
1 zmienionych plików z 3 dodań i 6 usunięć

Wyświetl plik

@ -23,10 +23,7 @@ DownloadSaver.prototype.save = function(text) {
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.setAttribute("download","tiddlywiki.html");
link.click();
return true;
};
@ -36,14 +33,14 @@ Information about this saver
*/
DownloadSaver.prototype.info = {
name: "download",
priority: 0
priority: 100
};
/*
Static method that returns true if this saver is capable of working
*/
exports.canSave = function(wiki) {
return true;
return document.createElement("a").download !== undefined;
};
/*