local storage - What causes a jQuery cookie function to work ok when tested 'locally' but then has an error when tested live at hosting site -
local storage - What causes a jQuery cookie function to work ok when tested 'locally' but then has an error when tested live at hosting site -
i have searched through several previous questions, , have not seen similar bug & resolution. here goes.
i using several jquery plugins, 2 of jquery cookie plugin , localstorage plugin chrome browsers.
building , testing locally, appears fine, cookie , storage wise.
then .js library crashes when few errors detected browser when loaded on live server.
code:
$(function (){ if( $.cookie('cookie_1') == 'visit_1' ){ $('#id1').dosomething(); $('#id2').dosomething(); } else if( $.sessionstorage('chromecookie_1') == 'chromevisit_1' ){ $('#id1').dosomething(); $('#id2').dosomething(); } else{return false;} });
i have several of these dual cookie type functions navigation etc. in inspectors in ff , chrome, tells me not function.
i have no error message on below function, in eyes carbon copy:
$(function (){ if( $.cookie('cookie_2') == 'checked_2' ){ $('#id3').dosomething(); } else if( $.localstorage('chromecookie_2') == 'checkedchrome_2' ){ $('#id3').dosomething(); } else{return false;} });
the difference there 2 jquery actions/statements(sorry don't have vocabulary) in first $.cookie
/ $.sessionstorage
function, , 1 jquery action/statement in sec example. , know first sessionstorage
, sec localstorage
, 1 time again have other more complicated sessionstorage
functions callback functions, don't error.
both(indeed all) of $.cookie
/ $.localstorage
functions nested in $(document).ready(function(){
, if matters.
jquery local-storage session-cookies jquery-cookie
Comments
Post a Comment