|
<!DOCTYPE html> |
|
<html lang="ja"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<title>Admin Access Cookie 切り替え</title> |
|
<style> |
|
body { |
|
font-family: sans-serif; |
|
padding: 2rem; |
|
} |
|
button { |
|
margin: 0.5rem; |
|
padding: 0.5rem 1rem; |
|
} |
|
#status { |
|
margin-top: 1rem; |
|
font-weight: bold; |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<h1>Admin Access Cookie 切り替え</h1> |
|
<button onclick="setAdminAccess()">admin_access=true を設定</button> |
|
<button onclick="removeAdminAccess()">admin_access を削除</button> |
|
<div id="status"></div> |
|
|
|
<script> |
|
function setAdminAccess() { |
|
|
|
document.cookie = "admin_access=true; path=/; max-age=86400"; |
|
updateStatus(); |
|
} |
|
|
|
function removeAdminAccess() { |
|
|
|
document.cookie = "admin_access=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC;"; |
|
updateStatus(); |
|
} |
|
|
|
function updateStatus() { |
|
const status = document.cookie.includes("admin_access=true"); |
|
document.getElementById("status").textContent = |
|
`document.cookie.includes("admin_access=true") の結果: ${status}`; |
|
} |
|
|
|
|
|
window.onload = updateStatus; |
|
</script> |
|
</body> |
|
</html> |
|
|