mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 18:40:28 +00:00
Browserstorage plugin: don't crash if local storage not available
Fix #6701
This commit is contained in:
parent
6eb4fbeead
commit
8fabcabebb
@ -115,13 +115,15 @@ function saveTiddlerToLocalStorage(title,options) {
|
||||
function clearLocalStorage() {
|
||||
var url = window.location.pathname,
|
||||
log = [];
|
||||
// Step through each browsder storage item
|
||||
for(var index=window.localStorage.length - 1; index>=0; index--) {
|
||||
var key = window.localStorage.key(index),
|
||||
parts = key.split("#");
|
||||
// Delete it if it's ours
|
||||
if(parts[0] === "tw5" && parts[1] === url) {
|
||||
window.localStorage.removeItem(key);
|
||||
// Step through each browser storage item
|
||||
if(window.localStorage) {
|
||||
for(var index=window.localStorage.length - 1; index>=0; index--) {
|
||||
var key = window.localStorage.key(index),
|
||||
parts = key.split("#");
|
||||
// Delete it if it is ours
|
||||
if(parts[0] === "tw5" && parts[1] === url) {
|
||||
window.localStorage.removeItem(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user