Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiteCranes authored Nov 26, 2024
1 parent a7ff11b commit e0d174c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,25 @@
</style>
</head>
<body>
<iframe id="myIframe" src="https://g.hzr0.com:99/gpt/" width="100%" height="100%" frameborder="0"></iframe>

<div id="maintenanceMessage">服务器升级中,过几个小时再来</div>
<script>
const iframe = document.getElementById('myIframe');

const maintenanceMessage = document.getElementById('maintenanceMessage');

iframe.onload = function() {
// iframe成功加载
window.location.href = "http://gpt.hzr0.com:98";
};

iframe.onerror = function() {
// iframe加载失败
maintenanceMessage.style.display = 'block';
iframe.style.display = 'none'; // 隐藏iframe
};

async function x(x) {
try {
await fetch('https://g.hzr0.com:99/gpt/');
// 访问成功,隐藏 maintenanceMessage
window.location.href = "http://gpt.hzr0.com:98";
} catch (error) {
maintenanceMessage.style.display = 'block';
iframe.style.display = 'none'; // 隐藏iframe
}
}

</script>
</body>
</html>

0 comments on commit e0d174c

Please sign in to comment.