The WebKit framework in OSX has a broken localStorage implementation which doesn't persist stored data (data isn't there after application restart).
So i've implemented an alternative LocalStorage object.
However, I can't assign window.localStorage = myLocalStorage
because localStorage
is defined as non-writeable, and non-configurable.
I can't find a way to override such property in JavascriptCore, by using the C/Obj-C APIs. Is there a way to do that?
You can't override it directly but you can use StorageItem to override it. But over-ridding storage item will override both session storage and localStorage
Second ways is to override with
__proto__
property but this is not standard, it is supported in firefox, chrom, opera not sure about othersCheck this example where they have wriiten to override default to store JSON objects
https://gist.github.com/danott/942522