webgrafia / ginger

Wordpress plugin to make website compliant with EU Cookie Policy, with opt-in feature
18 stars 7 forks source link

Shortcode reset cookie is working only on homepage #40

Open elpi07 opened 5 years ago

elpi07 commented 5 years ago

I have tested the RESET shortcode on different browsers and different sites. My experience was that if the shortcode was inserted on different (sub)page than the homepage, it does not work. I've made some investigation and find a solution. I had to add the "path=/;" option to delete_cookie function:

function delete_cookie(name, url) { document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;'; if(typeof url !== 'undefined'){ window.location.href = url; }else{ location.reload(); } }

This helped. Because without this at the new, generated cookie the path is not / but the name of the subpage. And this is a different cookie than that one wich we would like to delete.

If you think it is a good solution, please include this fix in the next release.