title: Why am I getting a TypeError when trying to call a function in an iFrame from the parent page?
body: <p>I have a page (parent) with an iFrame (child) embedded in it, the iFrame contains a javascript function that I need to call from the parent. The page are on different domains, I don't know if that's the issue though. This is my code on the parent page:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function SaveChanges() {
          var iFrame = document.getElementById("iframeSite");
          iFrame.contentWindow.ExecuteSave();
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>...and my code on the child page:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function ExecuteSave() {
          alert("test1");
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>When I call "SaveChanges" in the parent it errors at the line where it attempts to call "ExecuteSave".</p>
  
  <pre><code>Uncaught TypeError: Property 'ExecuteSave' of object [object DOMWindow] 
  is not a function
  </code></pre>
  
  <p>I've tried pretty much every variation of calling a child iFrame's function but still receive the same error.</p>