title: Call JavaScript from Silverlight hosted in IFrame
body: <p>I am developing a Silverlight application which is going to be hosted inside another's application IFrame:</p>
  
  <pre><code>&lt;hgroup class="title"&gt;
  &lt;h1&gt;@ViewBag.Title.&lt;/h1&gt;
  &lt;h2&gt;@ViewBag.Message&lt;/h2&gt;
  &lt;/hgroup&gt;
  &lt;script type="text/javascript"&gt;
      function testMethod() {
          alert(1);
      }       
  &lt;/script&gt;
  &lt;iframe src="URL of the silverlight application" width="750" height="500"/&gt;
  </code></pre>
  
  <p>This is just a dummy app for testing purposes (I am using the default MVC 4 template - this is actuly the Contacts.cshtml file)</p>
  
  <p>An this is the part where I call the JavaScript function.</p>
  
  <pre><code>HtmlPage.Window.Invoke("testMethod");
  </code></pre>
  
  <p>Any suggestions what to do/what I am doing wrong?</p>