cookies - How to save in local storage of Safari Private Mode -


i have app saves user name in local storage. works fine every browser except safari in private mode.

is there way save variable in safari private mode? tried using cookies it's doesn't work...

any work around?

i implemented localstoragehandler checks if browser supports local storage, if doesn't support use cookie.

this function checks if supports local storage:

localstoresupport: function () {     var testkey = 'test', storage = window.sessionstorage;     try     {         storage.setitem(testkey, '1');         storage.removeitem(testkey);         return true;     }     catch (error)     {         return false;     } } 

and how dealt false:

if (this.localstoresupport())     {         localstorage.setitem(name, value);     }     else     {         document.cookie = name + "=" + encodeuricomponent(value) + expires + "; path=/";     } 

i hope helps you.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -