I’d like to provide a button on my child page that would close the child page from the child page itself. To make matters worse, I didn’t write the child page – it is written using frames. So far I’ve tried this code in the child page:
Window.opener.location= '/parent page.html';
Window.close();
And, in the body:
<a href="JavaScript:if(confirm('close window?')) window.close()">close</a>
HELP!
As the link you inserted is inside an iframe, use
window.top.close()instead ofwindow.close().window.topwill refer to child window you created.HTML for your hyperlink will be