Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


IE Error - Unable to get value of the property 'getItem': object is null or undefined #55

LeeGDavis opened this Issue · 4 comments

3 participants

Lee Davis Jerome Gravel-Niquet Gavin Schulz
Lee Davis

I receive the following error using localStorage in a Backbone Collection when using IE9. Works great in firefox, opera, but IE9 not so much.

"SCRIPT5007: Unable to get value of the property 'getItem': object is null or undefined
backbone.localStorage.js, line 29 character 3"

offending line --> var store = this.localStorage().getItem(;

I have dom storage turned on in IE, I don't know what else I need. I'm new to backbone and the localStorage Adaptor, so hopefully I'm just doing something stupid.

I am using requirejs, but have created the necessary shim to use localStorage and like I said IE is the only issue other browser vendors works fine.

var TodosCollection = Backbone.Collection.extend({
model: Todo,
localStorage: new Backbone.LocalStorage('todos-backbone')

Jerome Gravel-Niquet

How are you accessing the page? Locally? (ie: "file://")

If you type window.localStorage in the browser's console, what do you get?

Lee Davis

Yes, locally... Just fired it up on my server and worked just fine. Is there a trick to getting this working locally off the filesystem and what is the issue?


  • local (file://): undefined
  • Server (http://): object storage


Gavin Schulz

@LeeGDavis there isn't a trick for local filesystem it just doesn't work. For localstorage to work you must be loading the page off of a server.

Lee Davis

No worries, thanks guys. Appreciate the help with this one!

Lee Davis LeeGDavis closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.