I used it
window.close()
It works fine. Other than that, IE11 requires confirmation:
“the webpage you are viewing is trying to close the tab. Do you want to close this tab?”
This will interrupt the function of the system, and the user does not know why it happened.
Are there any solutions for this?
I have explained the whole scenario so that you can provide a solution for any stage.
Thank you.
One way to solve this problem is to send a request to the servlet and return the file from the servlet. If this does not work for you, please let me know.
My requirement is that when I click to download a file, a new tab will be opened. If the file exists, it will start downloading, if it does not exist, it should close the new tab and display an error message.
I have used it
window.close()
It works fine. Besides, IE11 requires confirmation:
“the webpage you are viewing is trying to close the tab. Do you want to close this tab?”
This will interrupt the function of the system, and the user does not know why it happened.
Are there any solutions for this?
I have explained the whole scenario so that you can provide a solution for any stage.
Thank you.
When you try I have seen this alert when using window.close() on a window opened by the user; it is a security measure. You should not close the window through JavaScript opened by the user.
Solved One way to solve this problem is to send a request to the servlet and return the file from the servlet. If this doesn’t work for you, please let me know.