Context : I have set a cookie into my Rails app, to display to users only one time a popup (bootstrap modal).
Goal : I want to set the cookie for 1 month, with no
Issue : the code bellow works fine but when you close the navigator, the cookie is restarted. I think is the difference between session vs persistent cookie.
The stack of the app :
- Ruby on Rails
- JS cookie plugin : https://github.com/js-cookie/js-cookie
The code :
$(document).ready(function() {
if (Cookies('pop') == null) {
$('#MyModal').modal('show');
Cookies('pop', '31');
}
});
JS-cookie code here : https://github.com/js-cookie/js-cookie/blob/latest/src/js.cookie.js
Thanks!