I'm having a problem always when I'm trying to close a window through the window.close()
method of the Javascript, while the browser displays the below message on the console:
"Scripts may close only the windows that were opened by it."
This occurs in every part of the page. I can run this directly of a link, button, or a script, but this message always are displayed.
I'm tried to replace the window.close();
method for the functions (or variants of these) below, but nothing happened again:
window.open('', '_self', '');
window.close();
I searched for many pages of the web through of the Google and here on the Stack Overflow, but nothing suggested resolved my problem.
After many attempts, I've changed my way of testing that controller. Then I have discovered that the problem occurs always when I reopened the page through of the Ctrl + Shift + T
shortcut in Chrome. So the page ran, but without a parent window reference, and because this can't be closed.