From 1e5842dc1c381c4d935386519cfc440c3a71047c Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 23 May 2013 11:26:47 +0100 Subject: [PATCH] Fix download saver on Firefox Turns out that Firefox needs the link to be in the document before it will honour the click on it. --- core/modules/savers/download.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/modules/savers/download.js b/core/modules/savers/download.js index 92766593c..3f2e9c08f 100644 --- a/core/modules/savers/download.js +++ b/core/modules/savers/download.js @@ -24,7 +24,9 @@ DownloadSaver.prototype.save = function(text) { link.setAttribute("target","_blank"); link.setAttribute("href","data:text/html," + encodeURIComponent(text)); link.setAttribute("download","tiddlywiki.html"); + document.body.appendChild(link); link.click(); + document.body.removeChild(link); return true; };