/* ******************************************************************************* *** FILE: cnb_cookies.php *********************************************************************************/ function clearAllLocalData(){ window.localStorage.clear(); } function clearAllSessionData(){ window.sessionStorage.clear(); } /* ********************************************************** *** FUNCTION: cookieClear * *** DESCRIPTION: clears a named cookie * *** Parameters: * *** name = name of cookie * *** SRC: http://www.quirksmode.org/js/cookies.html * *********************************************************** */ function cookieClear(name){ cookieSet(name,"",-1); } /* ********************************************************** *** FUNCTION: cookieGet * *** DESCRIPTION: returns the value of a named cookie * *** or null on failure * *** Parameters: * *** name = name of cookie * *** SRC: http://www.quirksmode.org/js/cookies.html * *********************************************************** */ function cookieGet(name){ var nameEQ=name+"="; var ca=document.cookie.split(';'); for(var i=0;i1?arguments[1]:7; sa=sa>7?7:sa; //GET BIT COMPARISON VALUES //will check sessionStorage, localStorage, then cookies unless the sa is specified //check session first if(sa&1){ //alert('checking session'); var rslt=getSessData(di); if(rslt!=null){ // alert("Session Results:"+rslt); return rslt; } } if(sa&2){ //check local storage //alert('checking local storage'); var rslt=getLocalData(di); if(rslt!=null){ // alert("Local Storage Results:"+rslt); return rslt; } } if(sa&4){ //check client-side cookie //alert('checking cookies'); var rslt=cookieGet(di); if(rslt!=null){ // alert("Cookie Results:"+rslt); return rslt; } } return null; } /* ************************************* *** FUNCTION: setCSCache * *** ARGUMENTS: * *** ky = key * *** val = value * *** [sa] = storage area: * *** 0 = no storage (unused) * *** 1 = sessionStorage * *** 2 = localStorage * *** 4 = cookie * *** 8 = * *** therefore to set an item in all * *** storage locations(sessionStorage,* *** localStorage, & cookie) the sa * *** should be 7 * ***************************************/ function setCSCache(ky,val){ var NumArgs=arguments.length; sa=NumArgs>2?arguments[2]:7; sa=sa>7?7:sa; if(sa&1){ //set session first //alert('setting session storage'); setSessData(ky,val); } if(sa&2){ //set local storage //alert('setting local storage'); setLocalData(ky,val); } if(sa&4){ //set client-side cookie //alert('setting cookie'); if(val.length<8000){ cookieSet(ky,val,30); } } } //cf. C:\Server\www\cyphersystems.dev\public_html\cloud\js\ie8\cnb_hml.php for usage