how to override JAVAScript localStorage

+5 votes
asked Dec 13, 2012 in Objective C by admin (8,135 points)


   We develop html universal app  so we used cordova.  cordova having local storage for store some data in device

we don't need localStorage instead we plan to use coredataStorage(ios storage)..

so we plan to override the localStorage.  localStorage("key","value"); this call to the our overrided there any 

way do this?

1 Answer

+1 vote
answered Dec 13, 2012 by codeg (2,600 points)
edited May 3, 2017 by admin


 i hope this little bit of code solve your problem

Storage.prototype._setItem = Storage.prototype.setItem;

Storage.prototype.setItem = function(key, value)


  //do somthing here


Storage.prototype._getItem = Storage.prototype.getItem;

 Storage.prototype.getItem = function(key){

    // do somthing here