[英]javascript:window.close(); doesn't close the tab in IE 8
It works in Chrome and I thought it used to work in IE8... but it doesn't seem to. 它可以在Chrome浏览器中运行,我认为它曾经可以在IE8中运行...但是似乎没有。
javascript:window.open('', '_self', ''); window.close();alert('test');
All I get is the alert
. 我所得到的只是alert
。
Basically i'm trying to execute a function which works fine in the browser as an a
link, but using the same code in captivates "execute javascript" on a button, doesn't work. 基本上我试图执行其在浏览器中的正常工作的功能a
链接,但用深深吸引相同的代码上的按钮“执行JavaScript的”,不能正常工作。
Then I thought I would test it using javascript:
in IE... and it doesn't close it ether. 然后我以为我会使用javascript:
在IE中测试它...并且它不会关闭它。
Whats going on? 这是怎么回事?
It's driving me nuts. 它让我发疯。
I found that this works 我发现这可行
top.close();
From within the browser address bar 从浏览器地址栏中
javascript:top.close();
I don't know why, but the example from the link below didn't work for me. 我不知道为什么,但是下面链接中的示例对我不起作用。
http://www.w3schools.com/jsref/met_win_close.asp http://www.w3schools.com/jsref/met_win_close.asp
Worked: 工作:
window.close();
Didn't worked: 没有工作:
myWindow.close();
onclick="javascript: window.open('', '_self', ''); window.close();" onclick =“ javascript:window.open('','_self',''); window.close();”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.