on-internet
← Community

window.close() => "Scripts may close only the windows that were opened by it." & Outlook behavior

Stack Overflow ·

I have a link in my webpage to close window in javascript : <a href="#" onclick="window.close()">Close the window</a> But when I click it, I have this error in console : Scripts may close only the windows that were opened by it. I have done a search on google, and now, I know why. This is the normal behavior (for security reasons I think). But when I send the link of my page via Outlook, and then, I click to close the page : It works ! Why ???

Comments

Sign in or sign up to comment and upvote.

No comments yet.