自动关闭当前窗口并用新的URL地址打开新窗口 [英] Automatically Close current window and open new window with new URL address

查看:85
本文介绍了自动关闭当前窗口并用新的URL地址打开新窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码有问题,不再工作了,但不能重新打开新窗口.....使用以下代码自动关闭当前窗口,并用新URL打开新窗口。请仔细看看代码有什么问题。

 <!DOCTYPE HTML PUBLIC -  // W3C // DTD HTML 4.01过渡性// EN
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">
< html>
< head>
< meta http-equiv =prahmacontent =no-cache>
< title>自动关闭并打开新窗口< / title>
< meta http-equiv =Content-Typecontent =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>

此代码用于自动关闭当前网址,并在var中打开指定网址的新窗口。但您需要接受允许总是弹出本网站。



谢谢

解决方案

div>

试试这个



< html>< head> <脚本>函数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(等待,8000); }函数调用者(){setInterval(call,12000); } function wait(){popup.close(); closed(); }< / head>< body onload =caller(); gio();>< / body>< / html>< html> / pre>


there is something wrong with the code, not working anymore its closing but not reopening new window.....Was using following code for auto close current window and open new window with new URL. please have a look whats wrong with the code.

<!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>

this code is for auto closing current url and open new window with stated url in var. but you need to accept "allow always popup for this site".

Thanks

解决方案

try this

<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>
<html>

这篇关于自动关闭当前窗口并用新的URL地址打开新窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆