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

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -