使用以下代码可以实现在2秒后跳转页面:

<!DOCTYPE html>
<html>
<head>
  <title>Redirect Page</title>
  <script type="text/javascript">
    setTimeout(function () {
      window.location.href = 'https://www.example.com';
    }, 2000);
  </script>
</head>
<body>
  <iframe src='https://www.example.com'></iframe>
</body>
</html>

在上面的代码中,我们使用了JavaScript的setTimeout函数来设置一个2秒的延迟,然后在延迟结束后,使用window.location.href将页面跳转到指定的URL。同时,我们在<iframe>标签中嵌入了需要显示的页面URL。这样,在页面加载完毕后,2秒后页面将会自动跳转到指定的URL。

2秒后跳转页面:使用iframe实现延迟跳转

原文地址: https://www.cveoy.top/t/topic/mcEi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录