Improvement: set path to root path when cookie is set
-
Hi,
I have an improvement for the plugin.
If you visit the site e.g. via Google and open an article you will receive the modal box. However, when the box is closed the cookie is set only to the current path, meaning that the box will open again, if you visit another page, until you visited the main page, so you receive path=/This could be fixed if you update the setCookie method in an-scripts.js
function setCookie(cname, cvalue, exdays, cpath) { var d = new Date(); d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); var expires = "expires=" + d.toGMTString(); var path = "path=" + cpath; document.cookie = cname + "=" + cvalue + "; " + expires + "; " + path; }
I’ve added the path parameter to the method, a method call could be done with the additional argument:
setCookie('anCookie', 'true', anOptions.anOptionCookieLife, '/');
Cheers
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Improvement: set path to root path when cookie is set’ is closed to new replies.