Update Cleanup "setCookie" function notes options: secure, httpOnly, Samesite
This commit is contained in:
parent
dd0f8f4772
commit
b5ea0dfbc7
|
@ -6,19 +6,12 @@ Oqtane.Interop = {
|
|||
d.setTime(d.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
var expires = "expires=" + d.toUTCString();
|
||||
var cookieString = name + "=" + value + ";" + expires + ";path=/";
|
||||
|
||||
// Add SameSite attribute
|
||||
if (sameSite === "Lax" || sameSite === "Strict" || sameSite === "None") {
|
||||
cookieString += `; SameSite=${sameSite}`;
|
||||
}
|
||||
|
||||
// Add Secure attribute
|
||||
if (secure) {
|
||||
cookieString += "; Secure";
|
||||
}
|
||||
|
||||
// Note: HttpOnly cannot be set here; it needs to be handled server-side.
|
||||
|
||||
document.cookie = cookieString;
|
||||
},
|
||||
getCookie: function (name) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user