How to fix “set SameSite cookie to none” warning?

前端 未结 7 1768
生来不讨喜
生来不讨喜 2020-12-04 21:15

I created a chrome extension and from popup.js I called PHP script (Using Xhttprequest) that reads the cookie. Like this:

$cookie_name = \"mycookie\";

if(is         


        
7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-04 21:28

    If you are experiencing the OP's problem where your cookies have been set using JavaScript - for example:

    document.cookie = "my_cookie_name=my_cookie_value; expires=Thu, 11 Jun 2070 11:11:11 UTC; path=/";
    

    you could instead use:

    document.cookie = "my_cookie_name=my_cookie_value; expires=Thu, 11 Jun 2070 11:11:11 UTC; path=/; SameSite=None; Secure";
    

    It worked for me. More info here.

提交回复
热议问题