Hello everyone , I have question about the window.close() ,I have a button when I cliked to close the window I get this message “scripts may close only the windows that were opened by them” , even I try window.open(’’, ‘_self’, ‘’); window.close(); nothing seems working . can someone help me to solve this .
It is hard to answer this question without being able to see all of your code. I’ll just point out that Window.close() and window.close() are not the same thing. Is Window pointing to a WindowProxy object returned by window.open()?
Well, that snippet of code didn’t really help me. For security reasons, a script can only close windows that they opened. So just calling window.close() is not going to work. Your script must first open a new window (and save a reference to that window) and then it can use that reference to close the window.
If you are getting the error message “scripts may close only the windows that were opened by them” then you are violating that security principle somehow.