我有两个页面(index.html和main.html)。这是index.html body标签:
<a href="main.html">main page</a>
在主页面上我有一个按钮,当点击该按钮时,我想关闭此窗口,但此功能不起作用!我怎么能这样做?并在控制台中发出此警告:
Scripts may close only the windows that were opened by it.
答案 0 :(得分:0)
这应关闭窗口:
<form>
<input type="button" value="Close Window" onClick="window.close()">
</form>
答案 1 :(得分:0)
$('closeButton').click(function(){
window.close(); //only if you opened the window, and are the owner will this work!
});