From 215ec25a41f2280572f7b6d6e6c529ec8d9d345d Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 23 May 2012 14:39:05 +0000 Subject: [PATCH] translator: use a more robust test for localStorage support and show a warning if it is missing --- src/www/translator/translator.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/www/translator/translator.js b/src/www/translator/translator.js index a92cffc5b..cf3a033ca 100644 --- a/src/www/translator/translator.js +++ b/src/www/translator/translator.js @@ -5,6 +5,10 @@ function Translator() { this.local=tr_local(); this.view=element("document") + if(!supports_html5_storage()) { + var warning=span_class("error",text("It appears that localStorage is unsupported or disabled in this browser. Documents will not be preserved after you leave or reload this page!")) + insertAfter(warning,this.view) + } this.current=this.local.get("current") this.document=this.current && this.current!="/" && this.local.get("/"+this.current) || empty_document() this.server=pgf_online({}) @@ -395,7 +399,7 @@ function tr_local() { } } } - return window.localStorage ? real(localStorage) : real([]) + return supports_html5_storage() ? real(localStorage) : real([]) } // Collect alternative texts in the output from PGF service translate command