<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Loading...</title>
<style>
body {
  font-family: Arial, sans-serif;
  text-align: center;
  padding-top: 80px;
}
#countdown {
  font-size: 36px;
  font-weight: bold;
}
</style>
</head>
<body>
<h3>Loading secure page...</h3>
<p>Retrying secure connection in <span id="countdown">3</span> seconds</p>

<script>
(function () {
  var maxRetries = 10;
  var retryKey = "h3retry_count";
  var count = parseInt(sessionStorage.getItem(retryKey) || "0", 10);

  if (count >= maxRetries) {
    document.body.innerHTML = "<h3>Unable to switch to secure HTTP/3 connection.</h3><p>Please refresh manually or check your network.</p>";
    throw new Error("Max H3 retry reached");
  }

  sessionStorage.setItem(retryKey, String(count + 1));

  var seconds = 3;
  var el = document.getElementById("countdown");
  el.textContent = seconds;

  var timer = setInterval(function () {
    seconds -= 1;
    el.textContent = seconds;

    if (seconds <= 0) {
      clearInterval(timer);
      location.reload();
    }
  }, 1000);
})();
</script>
</body>
</html>