admin管理员组文章数量:1122826
First sorry for my bad english, i'm french. I need to make my website GDPR Friendly, so for this I use the plugin 'RGPD' who give me the possibility to check or uncheck multiples types of cookies. This plugin also give some functions to use.
Here is what I try :
if (!is_allowed_cookie('_ga')) {
?>
<script>
function deleteCookie(name) {
document.cookie = name + '=; Path=/; Domain=.youtube; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
var arr = ["GPS","APISID","CONSENT","HSID","LOGIN_INFO","PREF","SAPISID","SSID","VISITOR_INFO1_LIVE","YSC"];
var i = 0;
for ( i=0; i< arr.length; i++){
deleteCookie(arr[i],false,-1);
}
</script>
<?php
}
But no one of the cookies are deleted, or maybe they are, but they came back instantly after. I also try this method in PHP :
foreach($_COOKIE as $key => $value) {
unset($_COOKIE[$key]);
}
but nothing too, no one of the cookies was deleted.
So how can I do to delete a cookie ?
Thanks.
First sorry for my bad english, i'm french. I need to make my website GDPR Friendly, so for this I use the plugin 'RGPD' who give me the possibility to check or uncheck multiples types of cookies. This plugin also give some functions to use.
Here is what I try :
if (!is_allowed_cookie('_ga')) {
?>
<script>
function deleteCookie(name) {
document.cookie = name + '=; Path=/; Domain=.youtube.com; Expires=Thu, 01 Jan 1970 00:00:01 GMT;';
}
var arr = ["GPS","APISID","CONSENT","HSID","LOGIN_INFO","PREF","SAPISID","SSID","VISITOR_INFO1_LIVE","YSC"];
var i = 0;
for ( i=0; i< arr.length; i++){
deleteCookie(arr[i],false,-1);
}
</script>
<?php
}
But no one of the cookies are deleted, or maybe they are, but they came back instantly after. I also try this method in PHP :
foreach($_COOKIE as $key => $value) {
unset($_COOKIE[$key]);
}
but nothing too, no one of the cookies was deleted.
So how can I do to delete a cookie ?
Thanks.
Share Improve this question asked Jun 19, 2018 at 13:45 JessyJessy 1172 silver badges6 bronze badges 6 | Show 1 more comment2 Answers
Reset to default 0You can delete all cookies that belong to your domain. See the answer to this here: https://stackoverflow.com/questions/2310558/how-to-delete-all-cookies-of-my-website-in-php .
You would have to build a form with a button to that (on submit) would call the function that deleted the cookies that belong to your domain. I don't think you can delete cookies that don't belong to your domain.
I am currently also trying to configure this plugin to block cookies not allowed by users. So I am will keep an eye on this thread hoping someone will enlighten our path.
I also saw people around worried about 3rd party cookies like youtube. I know a trick that may help some folks:
SOLUTION: youtube.com allows us to embed videos with extended privacy functionality. All you have to do is replace youtube.com with youtube-nocookie.com
FOR EXAMPLE: instead of src="https://www.youtube.com/embed/videourl" just use src="https://www.youtube-nocookie.com/embed/videourl"
From now on to embed new videos you can also go to Youtube's video you want to embed select “Embed Options” and check the box “Enable privacy-enhanced mode.” This has gives you exactly what I described above: youtube-nocookie.com instead of youtube.com
本文标签: pluginsWordpress delete cookie
版权声明:本文标题:plugins - Wordpress delete cookie 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295498a1929584.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
Domain=.youtube.com
can be a source of problem for you I think :/ – Elex Commented Jun 19, 2018 at 14:25