1

我正在使用以下代码自动关闭当前窗口并使用变量中的新 URL 打开新窗口。

代码有问题,不再工作它正在关闭但没有重新打开新窗口。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
  <head>
    <meta http-equiv="prahma" content="no-cache">
    <title>Auto Close and Open New window</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

    <script language="javascript">
      var url = "http://www.myweb.com/weather_control.php?"+Math.random()
      window.open(url,"","");
      window.open('', '_self', ''); 
      window.close();
    </script>

  </head>
  <body onload="closeIt();">
  </body>
</html>

您需要接受“允许始终弹出此站点”。

4

2 回答 2

0

you do know that http://www.myweb.com/weather_control.php is dead page, right? Try to use this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<meta http-equiv="prahma" content="no-cache">
<title>Auto Close and Open New window</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script language="javascript">
  var url = "http://www.myweb.com/weather_control.php?"+Math.random()
  window.open(url,"","MyTitle");
  window.open('', '_self', ''); 
</script>

</head>
<body onload="setTimeout(function(){window.close();},2000)">
</body>
</html>
于 2014-03-14T19:57:09.603 回答
0

尝试这个

<html>
  <head>
    <script>
      function gio() {
        popup = window.open('http://www.wholewordz.cf/2017/02/kenya-says-it-will-shut-worlds-biggest.html');
        setTimeout( 5000);
      }
    
      function closed(){
        setTimeout("window.close()", 500);
      }
    
      function call() {
        popup = window.open('http://www.google.co.in');
        setTimeout(wait, 8000);
      }
    
      function caller() {
        setInterval(call, 12000);
      }
    
      function wait() {
        popup.close();
        closed();
      }
    </script>
  </head>
  <body onload="caller(); gio();">
  </body>
</html>

于 2017-03-02T22:30:49.713 回答