I am setting a cookie with javascript
document.cookie = "acceptCookies=1; expires=" + new Date(new Date().setFullYear(new Date().getFullYear() + 1)).toUTCString() + "; path=/; SameSite=Strict";
And it works just fine, but not when I open the site using the google search widget in android. In that case the cookie is lost every time I reopen it. SameSite=Lax has the same effect.
So I tried to reset it with php like this.
if ($_COOKIE['acceptCookies'] != "2"){
setcookie("acceptCookies", "2", ['expires' => time() + 3600*24*365, 'path' => '/', 'samesite' => 'Strict' ]);
}
But the problem is not solved. Has anyone an idea how to solve this problem?