Skip to content

Commit

Permalink
fix: add path when canSetCookies is initially being set (#18)
Browse files Browse the repository at this point in the history
prevents setting canSetCookies in every route
  • Loading branch information
0t4u authored Oct 6, 2024
1 parent 797d0f0 commit 591f0c9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function checkClientHints() {
if (!navigator.cookieEnabled) return;
// set a short-lived cookie to make sure we can set cookies
document.cookie = "canSetCookies=1; Max-Age=60; SameSite=Lax";
document.cookie = "canSetCookies=1; Max-Age=60; SameSite=Lax; path=/";
const canSetCookies = document.cookie.includes("canSetCookies=1");
document.cookie = "canSetCookies=; Max-Age=-1; path=/";
if (!canSetCookies) return;
Expand Down

0 comments on commit 591f0c9

Please sign in to comment.