Posted By

pussard on 05/04/11


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

shalomfriss


Session Vars


 / Published in: JavaScript
 

Sets and gets session information via window.name

  1. function setSessionVar(k,v){var w=window.name;v=escape(v);if(w.indexOf(k)!==-1){w=w.replace(w.split(k+'=')[1].split('&')[0],v)}else if(w.length){w=w+'&'+k+'='+v}else{w=k+'='+v}window.name=w}function getSessionVar(k){var w=window.name;if(w.indexOf(k)!==-1){return unescape(w.split(k+'=')[1].split('&')[0])}else{return''}}

Report this snippet  

You need to login to post a comment.