Skip to content

Commit 591f0c9

Browse files
authored
fix: add path when canSetCookies is initially being set (#18)
prevents setting canSetCookies in every route
1 parent 797d0f0 commit 591f0c9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function checkClientHints() {
5757
if (!navigator.cookieEnabled) return;
5858
5959
// set a short-lived cookie to make sure we can set cookies
60-
document.cookie = "canSetCookies=1; Max-Age=60; SameSite=Lax";
60+
document.cookie = "canSetCookies=1; Max-Age=60; SameSite=Lax; path=/";
6161
const canSetCookies = document.cookie.includes("canSetCookies=1");
6262
document.cookie = "canSetCookies=; Max-Age=-1; path=/";
6363
if (!canSetCookies) return;

0 commit comments

Comments
 (0)