javascript - local Storage is not defined : JQuery -
i using piece of code inside javascript function. when run application gives reference error local storage not defined.
localstorage.setitem(result.key+authappparams.application , result.key);
why occurs? why can't use inside function? since setitem , releated values inside method cannot define local storage globally.
how can avoid issue , make work?
when using localstorage should check first make sure browser has implemented.
something this
if(window.localstorage) { // localstorage can used } else { // can't used }
should check on in code , use if it's available.
js on global variable cannot find in current context, looks if comes down browser not having it.
edit commenting, localstorage , jquery separate
Comments
Post a Comment