Why does it not set the SameSite cookie attribute?

26 Views Asked by At

I am accessing youtube videos on my website and getting an error, that I should specify my SameSite cookies manually but when I do so, it just doesn't work and gives me the same error.

The error message: Indicate whether a cookie is intended to be set in a cross-site context by specifying its SameSite attribute.

My try plain with Javascript:

<script>
    document.cookie = "AC-C=ac-c;expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;SameSite=Lax";
</script>

My try with js-cookie:

<script type="module" src="/js-cookie/js.cookie.mjs"></script>
<script type="module">
    import Cookies from '/js-cookie/js.cookie.mjs'

    Cookies.set('name', 'value', {
        sameSite: 'none',
        secure: true
    });
</script>
0

There are 0 best solutions below