Developing and testing features or extensions for Microsoft Edge
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
edge developer tool console log Scripts may close only the windows that were opened by them.
If the script didn't start opening the window (something like window.open), then the script in that window seems to have been changed to a security that prevents websites that can't close the window take control of the browser and close the window.
window.open('your current page URL', '_self', '');
window.close();
edge browser not close.
solution javascript code or another api
Thanks for letting me know the part.
Please inquire above.
Developing and testing features or extensions for Microsoft Edge
Hi @hoseon-song ,
window.open('your current page URL', '_self', '');
window.close();edge browser not close.
I did some testing on this issue, and with reference to the relevant documentation, I think this result is reasonable. Just refer to this doc: the latest working spec for window close(). As metioned in this doc:
A browsing context is script-closable if it is an auxiliary browsing context that was created by a script (as opposed to by an action of the user), or if it is a top-level browsing context whose session history contains only one Document.
In my tests, the script you mentioned works correctly if the page is launched by Visual Studio or by the command line (created by script): msedge.exe www.google.com. Conversely, pages opened manually by the user cannot be closed by script(not initial interface when opening browser ). This is all as described.
Regards,
Xudong Peng
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.