Why can't I extend localStorage on IE8 (javascript)?

RoumpDeedReop

New Member
I'd like to add 2 methods to localStorage. My goal is to end up with something like this:\[code\]localStorage.setObject(key, object);localStorage.getObject(key);\[/code\]This solution works in most browsers but not IE8:\[code\]Storage.prototype.setObject = function(key, value) { this[key] = JSON.stringify(value);}Storage.prototype.getObject = function(key) { return JSON.parse(this[key]);}\[/code\]After doing some research, apparently I could use Lawnchair.js or work around it some other way. But I'm wondering why it doesn't work in IE8. I can extend String and Array. Why not Storage? How can I find out which objects I can extend and which ones I can't extend in IE8?
 
Top