Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lib/plugins/sammy.storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,17 @@
};
$.extend(Sammy.Store.LocalStorage.prototype, {
isAvailable: function() {
return ('localStorage' in window) && (window.location.protocol != 'file:');
if (('localStorage' in window) && (window.location.protocol != 'file:')) {
try {
window.localStorage.setItem('sammyjs_test', 'This is just a test if I can set something in the local storage. There is nothing to see here, please continue ...');
window.localStorage.removeItem('sammyjs_test');
return true;
} catch (ex) {
// Oh noes, localStorage is available but I can't set anything ... maybe the limit is reached?
return false;
}
}
return false;
},
exists: function(key) {
return (this.get(key) != null);
Expand Down