mirror of
				https://github.com/Jermolene/TiddlyWiki5
				synced 2025-10-31 07:32:59 +00:00 
			
		
		
		
	Browserstorage plugin: don't crash if local storage not available
Fix #6701
This commit is contained in:
		| @@ -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); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jeremy@jermolene.com
					jeremy@jermolene.com