Is it possible to check if script opened a window with Javascript?
I have User agreements and they are opened in new window and this works (when i try to close the window)
<a href="JavaScript:window.close()" class="btn btn-default">Return</a>
But what i would like to accomplish is that if user go directly to /agreeement and clicks close that it redirects him to the homepage. Because now if i do that i get a message
Scripts may close only the windows that were opened by it.
And i understand why. That is why i would like to make a check where if the window was not open from a script redirect to index. But i dont how would i make that check