web: support using localStorage for state

This adds support for checking to see if the browser supports
the HTML5 localStorage, if so use that instead of cookies for
storing the UI state.
This commit is contained in:
Damien Churchill 2011-10-04 22:16:42 +01:00
parent 280377ad6f
commit 64bacbfbf4

View File

@ -31,7 +31,14 @@
*/ */
// Setup the state manager // Setup the state manager
Ext.state.Manager.setProvider(new Ext.state.CookieProvider()); var provider = Ext.state.CookieProvider;
try {
if ('localStorage' in window && window['localStorage'] !== null) {
provider = Ext.state.LocalStorageProvider;
}
} catch (e) {
}
Ext.state.Manager.setProvider(new provider());
// Add some additional functions to ext and setup some of the // Add some additional functions to ext and setup some of the
// configurable parameters // configurable parameters