<script type="text/javascript" src="/misc/js/crosscookie/CrossBrowserCookieManager.js"></script>
<script type="text/javascript">
/*
jQuery and SWFObject are required. Everything else is in the CrossBrowserCookieManager namespace.
It initializes automatically, all you need to do is call either:
CrossBrowserCookieManager.LoadCookie()
To load from cross browser storage into document.cookie
CrossBrowserCookieManager.SaveCookie()
To save document.cookie back to cross browser storage
*/
$(function(){
// make current document.cookie visible
setInterval(function(){
$('#out').html(document.cookie);
},100);
// saves new cookie
$('#save').click(function(){
document.cookie = $('#name')[0].value+'='+$('#value')[0].value;
// call to cross browser manager stores current document.cookie in cross browser storage
CrossBrowserCookieManager.SaveCookie();
});
$('#load').click(function(){
// appends cross browser store to current document.cookie
CrossBrowserCookieManager.LoadCookie();
});
});
</script>
<tr style="display:none">
<td>
<p>Current document.cookie: <span id="out"></span><br /></p>
<fieldset>
<label>Name <input id="name" value="Hello" /></label>
<label>Value <input id="value" value="World" /></label>
<button id="save">Save</button>
</fieldset>
<h3>Load cookie from cross browser storage</h3>
<button id="load">Load</button>
</td>
</tr>