title: How to Call Parent Window JavaScript Function inside iframe
body: <p>Here is my code on <code>http://my-localhost.com/iframe-test.html</code></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;Welcome Iframe Test&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;iframe src="http://www.my-website.com/index.html" width="500" height="500"&gt;&lt;/iframe&gt;
  &lt;script type="text/javascript"&gt;
  function alertMyMessage(msg){
      alert(msg);
  }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is code on <code>http://www.my-website.com/index.html</code></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/title&gt;Welcome to my Server&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
  &lt;h1&gt;Welcome to My Server&lt;/ht&gt;
  &lt;a href="javascript:void(0)" title="Click here" onClick="parent.alertMyMessage('Thanks for Helping me')"&gt;Click Here&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When i Click the "Click Here" Link. i got following Error.</p>
  
  <blockquote>
    <p>Uncaught SecurityError: Blocked a frame with origin
    "<a href="http://www.my-website.com">http://www.my-website.com</a>" from accessing a frame with origin
    "<a href="http://my-localhost.com">http://my-localhost.com</a>". Protocols, domains, and ports must match.</p>
  </blockquote>
  
  <p>Please Help me to Fix this Issue, or give some other solution for this.</p>