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.
Domain=.youtube.com
can be a source of problem for you I think :/