How to know if window.opener comes from my webpage?
<p>I have a login popup that modifies its parent page with window.opener.location.href = XXX. The code goes something like this.</p>

<pre><code>  if (window.opener) {
      window.opener.location.href = window.location.href;
      self.close();
  } 
</code></pre>

<p>The problem with this, is that if someone has a link to my webpage, like lets say, a link from an email, this code will be executed and the parent is the email client. This will throw a javascript error cause I'm trying to alter a webpage that is not mine.(In Chrome, it says "Unsafe JavaScript attempt to access frame with URL")</p>

<p>I want to know if there is a way I can find out if the window.opener comes from my webpage.</p>
