Until now I used only persistent cookies. Now I need to create a session cookie that will expire when the browser closes. Could you please give me suggestion how to do it ?
To create a session cookies, you have to use a similar code like in case of persistent cookies. Only difference is, that you have to not include the expiration date.
Example of persistent cookie code:
var date = new Date();
var expiry = '; expires=' + date.toUTCString();
document.cookie = 'abc=123'+expiry+'; path=/';
Example of session cookie code:
document.cookie = 'abc=123; path=/';