mirror of
https://github.com/Mastermindzh/react-cookie-consent.git
synced 2025-01-21 02:50:58 +01:00
Adds fallback for older incompatible browsers with samesite=none
This commit is contained in:
parent
ee7ac9ed86
commit
a45da474b4
@ -125,6 +125,9 @@ class CookieConsent extends Component {
|
|||||||
|
|
||||||
if (samesite === SAMESITE_OPTIONS.NONE) {
|
if (samesite === SAMESITE_OPTIONS.NONE) {
|
||||||
Cookies.set(cookieName, cookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, cookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
||||||
|
|
||||||
|
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
|
||||||
|
Cookies.set(cookieName, cookieValue, { expires, secure: true, ...extraCookieOptions });
|
||||||
} else {
|
} else {
|
||||||
Cookies.set(cookieName, cookieValue, { expires, samesite, ...extraCookieOptions });
|
Cookies.set(cookieName, cookieValue, { expires, samesite, ...extraCookieOptions });
|
||||||
}
|
}
|
||||||
@ -157,6 +160,9 @@ class CookieConsent extends Component {
|
|||||||
|
|
||||||
if (setDeclineCookie && samesite === SAMESITE_OPTIONS.NONE) {
|
if (setDeclineCookie && samesite === SAMESITE_OPTIONS.NONE) {
|
||||||
Cookies.set(cookieName, declineCookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
Cookies.set(cookieName, declineCookieValue, { expires, samesite, secure: true, ...extraCookieOptions });
|
||||||
|
|
||||||
|
// Fallback for older browsers where can not set SameSite=None, SEE: https://web.dev/samesite-cookie-recipes/#handling-incompatible-clients
|
||||||
|
Cookies.set(cookieName, declineCookieValue, { expires, secure: true, ...extraCookieOptions });
|
||||||
} else if (setDeclineCookie) {
|
} else if (setDeclineCookie) {
|
||||||
Cookies.set(cookieName, declineCookieValue, { expires, samesite, ...extraCookieOptions });
|
Cookies.set(cookieName, declineCookieValue, { expires, samesite, ...extraCookieOptions });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user