Presentation
This jQuery plugin tries to simulate session vars in javascript using the window.name property to store data.
Inspired by an idea by Mario Heiderich. Requires jquery.json.js by DeadWisdom.
Usage
To store
In page A
<script type="text/javascript">
$(function() {
$.session("var1", "value1");
$.session("var2", "value2");
$.session("var3", "value3");
});
</script> To read
In page A, B, ...
<script type="text/javascript">
$(function() {
alert( $.session("var1") );
alert( $.session("var2") );
alert( $.session("var3") );
});
</script> Warning
Despite of the document.referer check, this plugin might bring security issues. No complex tests have been ran.
Know Issue
- Vars are lost in the page is open in another window or tab. - Objects with functions can't be stored - Window.name is lost - Only Strings can be stored
