Cookie has been rejected because it is in a cross-site context

Firefox writes this message when a page in a frame from another site sets a cookie with SameSite=Lax or SameSite=Strict. Firefox does not keep the cookie, so the frame acts as if the user is signed out.

  • Chrome
  • Edge
  • Firefox

Updated

Console error · Firefox, exact text

Cookie “session” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.

FirefoxExact text

The frame loads, but the cookie is not set.

Cookie “session” has been rejected because it is in a cross-site context and its “SameSite” is “Lax” or “Strict”.

Chrome, EdgeExact text

The frame loads, but the cookie is not set.

This attempt to set a cookie via a "Set-Cookie" header was blocked because it had the "SameSite=Lax" attribute but came from a cross-site response which wasn’t the response to a top-level navigation

On this page

What it means

Firefox did not keep a cookie that the page in the frame tried to set. The cookie allows only same-site use, and the frame is on another site. Logins, carts, and settings in the frame then do not work. Read about cookies in iframes.

Why it happens

The page in the frame sends a cookie with a same-site rule:

Set-Cookie: session=abc123; SameSite=Strict
  1. The name in the message (“session” here) is the name of your cookie.

  2. A cookie with SameSite=None but no Secure gets another message: “rejected because it has the “SameSite=None” attribute but is missing the “secure” attribute”.

  3. Firefox also keeps a separate cookie jar for each top site, so a cookie from a visit to the site itself is not in the frame.

Check the page

See the headers the page sends now

Fix it if you own the site

Set the cookie with SameSite=None; Secure; Partitioned. The cookies guide explains each attribute.

Response header
Set-Cookie: session=abc123; Path=/; Secure; HttpOnly; SameSite=None; Partitioned

A cookie with SameSite=None must also have Secure, and the page must use HTTPS. Without Secure, the browser rejects the cookie.

If you do not own the site

You cannot change the cookies of another site. Use one of these.

  1. Open the page in a new tab

    Link to the page so the user signs in on the site itself, where its cookies work.

  2. Use the official embed

    Some services give an embed that needs no login, or one that is made for frames.

  3. Ask the owner

    Ask them to set their cookie with SameSite=None, Secure and Partitioned.

Sources

Know before you embed.

Free, no sign-up, nothing stored. Paste a URL and get a verdict, a live preview, and the fix.