Javascript:弹出窗口如何关闭?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6665869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 21:27:36 来源:igfitidea点击:
Javascript: How can a popup close itself?
提问by Linksku
I have a page that sometimes open in a popup and sometimes open normally. How can I create a link that closes the page if it's in a popup?
我有一个页面,有时会在弹出窗口中打开,有时会正常打开。如果页面在弹出窗口中,如何创建关闭页面的链接?
回答by Naftali aka Neal
Use javascript:
使用 JavaScript:
window.close();
Or in a link:
或在链接中:
<a href="javascript: window.close();">CLOSE ME</a>