Files
gerrit/test_cookie.html
2025-12-22 17:12:39 +08:00

47 lines
1.6 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<title>Gerrit Cookie 测试</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Gerrit Cookie 测试页面</h1>
<p>这个页面用于测试浏览器是否能正确保存 Cookie。</p>
<h2>测试步骤:</h2>
<ol>
<li>打开浏览器开发者工具F12</li>
<li>切换到 Application 标签</li>
<li>查看 Cookies → http://101.43.95.130:8080</li>
<li>点击下面的按钮测试 Cookie</li>
</ol>
<button onclick="testCookie()">测试 Cookie</button>
<div id="result"></div>
<script>
function testCookie() {
// 设置测试 Cookie
document.cookie = "test_cookie=test_value; path=/; SameSite=None; Secure=false";
// 读取 Cookie
var cookies = document.cookie;
var result = document.getElementById("result");
if (cookies.includes("test_cookie")) {
result.innerHTML = "<p style='color: green;'>✅ Cookie 设置成功!浏览器支持 Cookie。</p>";
result.innerHTML += "<p>Cookie 内容: " + cookies + "</p>";
} else {
result.innerHTML = "<p style='color: red;'>❌ Cookie 设置失败!浏览器阻止了 Cookie。</p>";
result.innerHTML += "<p>请检查浏览器 Cookie 设置。</p>";
}
}
</script>
<hr>
<h2>Gerrit 登录链接:</h2>
<p><a href="http://101.43.95.130:8080/login?account_id=1000000" target="_blank">点击这里使用 Account ID 1000000 登录</a></p>
</body>
</html>