if(window.opener.document.location.href!="http://www.yourdomain.com/somepage.html") { alert("bahh.. you didn't come here from the correct page"); }