驗證時 google瀏覽器 135.0.7049.117 不生效
- cookie.html
<!DOCTYPE html>
<html lang="zh">
<head><meta charset="UTF-8"><title>Cookie 檢測</title>
</head>
<body><h1>檢測是否啟用 Cookie</h1><p>頁面加載后會自動檢測。</p><script>function checkCookiesEnabled() {// Try setting a temporary cookiedocument.cookie = "testCookie=testValue; max-age=5; path=/";// Check if the cookie was setif (document.cookie.indexOf("testCookie=") !== -1) {// Cookie is enabled, now clear the temporary cookiedocument.cookie = "testCookie=; max-age=0; path=/";return true;} else {return false;}}if (checkCookiesEnabled()) {console.log("Cookies are enabled (verified by setting a cookie).");} else {console.log("Cookies are disabled (verified by setting a cookie).");}</script>
</body>
</html>
- cookie.html 同級文件夾 啟動服務
python -m http.server 8000
- 訪問服務
http://localhost:8000/cookie.html