Hi @Bipin kumar ,,
Window.close() is sometimes tricky.
Could the links below point you to the right direction.
https://textslashplain.com/2021/02/04/window-close-restrictions/
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi Expert,
We use ClientScript.RegidterStartupScript to open new window using window.open on button click and at the same time we use window.close to close the page once processing is completed.
Page.ClientScript.RegidterStartupScript(Page.Type(), "Close window","window.open(URL, name, specs);window.close();",true);
This code works in IE but not in Edge. In IE page is getting closed automatically but not in Edge.
Please help to fix this issue.
Thanks
Hi @Bipin kumar ,,
Window.close() is sometimes tricky.
Could the links below point you to the right direction.
https://textslashplain.com/2021/02/04/window-close-restrictions/
Hi @Bipin kumar ,
This code works in IE but not in Edge. In IE page is getting closed automatically but not in Edge.
As already mentioned, the main reason is that there are differences between what browsers implement.
In Internet Explorer, pages opened by window.open()
are silently closed by window.close()
function. There’s no attempt to check whether the back/forward stack contains only one document.
But in Edge, window.close()
only succeeds if the new window/tab has an opener or if the back/forward stack contains fewer than two entries. Just refer to the dom-window-close section of the HTML Standard, and I recommend that you pay more attention to modern browsers.
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.