What's best practice for using backbone.js with localStorage for IE7 and IE6?
I'm developing an application with backbone.js, back and socket.io, and I'm running into trouble with localStorage on开发者_StackOverflow社区 ie7 and ie6.
Have you chased IE7/Window Phone compatibility with backbone before? What was your solution for storing the model client-side?
Based on Bryan Bailliache's answer above, I created a seamless Amplify backend for Backbone.js, you can check out https://github.com/dev360/Backbone.amplify. Hope it's useful.
The AmplifyJS project has a storage abstraction that
amplify.store is a wrapper for various persistent client-side storage systems. amplify.store supports IE 5+, Firefox 2+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+ and provides a consistent API to handle storage cross-browser.
Since it works on IE 5+, that should fix the troubles your having.
Unfortunately I have not done WinPhone compatibility but I have done IE 7+ compatibility for Windows and the AmplifyJS project met my requirements.
I needed the same thing.
As this question is 1 year old and https://github.com/dev360/Backbone.amplify last commit 2 years old and not up to date with current Backbone.localStorage version
I did a new Backbone.localStorage using Amplify https://github.com/fadomire/Backbone.amplifyLocalStorage
I'll try to keep it up to date and fix issues, but no guarentee.
The Backbone.js page has a demo "ToDo List" app that has a localStorage adapter that comes with it. I would modify this, check for window.localStorage and fallback to using cookies or an ajax call to the backend.
精彩评论