I have a child page that can be opened either from its parent page on the same domain (mydomain.com) or from other pages on other domains (as a link) such as facebook, email link etc. How can I check whether or not the child window was opened by the parent window on mydomain.com? The reason is that I want to run a jQuery code only if the window opener exists and it is on mydomain.com. Something like the following code:
if (window.opener && /*window opener is on mydomain.com*/ )
{
alert('Window opener exists and on my domain');
}