From 72974f2548755ff9d1ee2458c64e780164a18685 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Sat, 20 Oct 2018 02:07:10 +0200 Subject: [PATCH] TiddlyWiki: bugfix for Firefox Quantum -- use HTML5 web storage instead of a Cookie Firefox Quantum adopted the idiotic behaviour of Chrome and does no longer retrieve Cookies for pages read from local file system. It stores the Cookie data into its local cookies.sqlite, but it does not retrieve it anymore. For aledged "security reasons", however it happily retrieves HTML 5 web storage Since TiddlyWiki classic just accesses the document.cookie at 3 points, it is easy to patch around that problem. Just check, if we're using a modern browser with support for HTML5 web storage and branch accordingly. --- wiki/empty.html | 32 ++++++++++++++++++++++++++++---- wiki/renderengine.html | 32 ++++++++++++++++++++++++++++---- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/wiki/empty.html b/wiki/empty.html index e26bb319c..21452b8f8 100644 --- a/wiki/empty.html +++ b/wiki/empty.html @@ -6261,6 +6261,16 @@ var loadOptionsCookie = loadOptions; function getCookies() { + if (typeof(Storage) !== "undefined") { + // modern browser: use HTML5 web storage + var storedData = {}; + for (var n = window.localStorage.length || 0; --n >= 0; ) { + var key = window.localStorage.key(n); + storedData[key] = window.localStorage[key]; + } + return storedData; + } + // else: use old-style cookie storage var cookieList = document.cookie.split(';'); var i,cookies = {}; for(i=0; i= 0; ) { + var key = window.localStorage.key(n); + storedData[key] = window.localStorage[key]; + } + return storedData; + } + // else: use old-style cookie storage var cookieList = document.cookie.split(';'); var i,cookies = {}; for(i=0; i