code to set cookie not working on IE
i have written this code in order to set a cookie and then make it expire as the user leaves the page:
It works fine on Firefox and Chrome but as usual not on IE (its a piece of ｓhit, you know). Could anybody please recommend me a cross-browser solution?
<script>document.cookie ='chat=sesion; path=index.php';</script>
document.cookie='chat=;expires=Thu, 01-Jan-70 00:00:01 GMT;';
window.onunload = clearCookie;