mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-22 09:32:53 -06:00
gfse: show an informative error message in browsers that lack support for localStorage
This commit is contained in:
@@ -1440,9 +1440,13 @@ function dir_bugfix() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(editor) {
|
if(editor) {
|
||||||
|
if(supports_html5_storage()) {
|
||||||
initial_view();
|
initial_view();
|
||||||
touch_edit();
|
touch_edit();
|
||||||
dir_bugfix();
|
dir_bugfix();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
editor.innerHTML="<p>This browser does not appear to support localStorage, and the grammar editor does not work without it. Sorry!"
|
||||||
}
|
}
|
||||||
|
|
||||||
//console.log("hi")
|
//console.log("hi")
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
// Grammars are stored locally in the browser using localStorage.
|
// Grammars are stored locally in the browser using localStorage.
|
||||||
// See http://diveintohtml5.info/storage.html
|
// See http://diveintohtml5.info/storage.html
|
||||||
|
|
||||||
|
function supports_html5_storage() {
|
||||||
|
try {
|
||||||
|
return 'localStorage' in window && window['localStorage'] !== null;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var local={
|
var local={
|
||||||
prefix:"gf.editor.simple.grammar",
|
prefix:"gf.editor.simple.grammar",
|
||||||
get: function (name,def) {
|
get: function (name,def) {
|
||||||
|
|||||||
Reference in New Issue
Block a user