1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-13 02:40:26 +00:00

Fix issue with localStorage error on Firefox

Firefox raises an error if window.localStorage is accessed when cookies
are disabled:

https://bugzilla.mozilla.org/show_bug.cgi?id=771890
This commit is contained in:
Jermolene 2014-07-06 10:11:21 +01:00
parent 465f4ac469
commit 3351ae7e29

View File

@ -96,16 +96,23 @@ exports.getBoundingPageRect = function(element) {
Saves a named password in the browser
*/
exports.savePassword = function(name,password) {
try {
if(window.localStorage) {
localStorage.setItem("tw5-password-" + name,password);
}
} catch(e) {
}
};
/*
Retrieve a named password from the browser
*/
exports.getPassword = function(name) {
try {
return window.localStorage ? localStorage.getItem("tw5-password-" + name) : "";
} catch(e) {
return "";
}
};
/*