Reading MDN for SameSite=Lax
, it says:
Cookies are allowed to be sent with top-level navigations and will be sent along with GET request initiated by third party website. This is the default value in modern browsers.
To me that sounds like I could initiate a fetch in JavaScript from a 3rd party, and as long as it's a GET the cookies will be sent.
But according to this answer, even GET requests are only sent during top-level navigation, ie not from JS.
I'm guessing the answer is correct. I really hope so because I'm trying to secure an API and I only want cookies being sent when the user navigates to the 1st-party site, ie for Oauth2 interactions etc. SameSite=Strict
isn't working for me because if I link to a resource on the 1st-party server, it's still blocked if the referer indicates the navigation came from somewhere else. Refreshing the page doesn't work either. I have to manually navigate to the URL.
EDIT: I just tested this and the behavior is as I hoped. The cookies are not sent with SameSite=Lax
fetches. Am I the only one confused by the MDN wording?