How to use cookies for CEP panel
Hi,
Can anyone show a basic example of writing and reading cookies values for the panel?
I want to store the user settings and i could not find any example for it, though I ma still searching.
Thank you,
Hi,
Can anyone show a basic example of writing and reading cookies values for the panel?
I want to store the user settings and i could not find any example for it, though I ma still searching.
Thank you,
Which event is triggered by closing the panel?
I want to run a function which saves the session cookies when the panel is closed.
Check below snippets. It might help your work.
//Set session cookie
document.cookie = "testCookie="+"testStrings"; //Key and Value
//Set persistent cookie
var dt = new Date();
dt.setTime(dt.getTime() + (30*24*60*60*1000));
var ce = "; expires=" + dt.toGMTString(); //persistent cookie needs expires time
var val = "persistentCookie="+"testStrings";
document.cookie = val + ce;
//Get cookies
alert(document.cookie);
//Set and Get localstorage
localStorage.setItem('storageTestKey', "StringFromLocalStorage");
localStorage.getItem('storageTestKey');
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.