Skip to content

Commit d1f41c5

Browse files
committed
adjust cookie clearing mechanism
1 parent 59a2667 commit d1f41c5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

components/blog/cookie-shadowing/ClearCookiesOnLoad.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export function ClearCookiesOnLoad() {
77
document.cookie = `my_cool_cookie=; expires=${expireDate}`;
88
document.cookie = `my_cool_cookie=; path=/blog/cookie-shadowing; expires=${expireDate}`;
99
document.cookie = `my_cool_cookie=; domain=${window.location.hostname}; expires=${expireDate}`;
10-
document.cookie = `my_cool_cookie=; partitioned; secure; samesite=none; expires=${expireDate}`;
10+
document.cookie = `my_cool_cookie=; path=/blog/cookie-shadowing; domain=${window.location.hostname}; expires=${expireDate}`;
1111
}, []);
1212
return null; // This component doesn't render anything
1313
}

pages/blog/cookie-shadowing/content.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ console.log("document.cookie:", document.cookie);
8585
document.cookie = \`my_cool_cookie=; const expireDate = "Thu, 01 Jan 1970 00:00:00 GMT"\`;
8686
document.cookie = \`my_cool_cookie=; path=/blog/cookie-shadowing; expires=Thu, 01 Jan 1970 00:00:00 GMT\`;
8787
document.cookie = \`my_cool_cookie=; domain=\${window.location.hostname}; expires=Thu, 01 Jan 1970 00:00:00 GMT\`;
88-
document.cookie = \`my_cool_cookie=; partitioned; secure; samesite=none; expires=Thu, 01 Jan 1970 00:00:00 GMT\`;
88+
document.cookie = \`my_cool_cookie=very_specific; domain=\${window.location.hostname}; path=/blog/cookie-shadowing; expires=Thu, 01 Jan 1970 00:00:00 GMT\`;
8989
console.log("document.cookie:", document.cookie || 'None!');
9090
`}</RunnableCodeBlock>
9191

0 commit comments

Comments
 (0)