title: Calling A Javascript function from Silverlight
body: <p>I'm attempting to call a javascript function (in our code) from a silverlight control. I'm attempting to call the function via:</p>
  
  <p><code>HtmlPage.Window.Invoke("showPopup", new string[] { "http://www.example.com" });</code></p>
  
  <p>and I get the error "Failed to Invoke: showPopup"</p>
  
  <p>I can call <code>HtmlPage.Window.Invoke("alert", new string[]{"test"});</code> without issue, but not my own function. </p>
  
  <p>I can also open up the page in question in the IE developer tools and manually call <code>showPopup("http://www.example.com")</code> and it works as expected. </p>
  
  <p>So the js function works, and the Silverlight binary can find other js functions. What am I missing here?</p>
  
  <p>Additional Notes:</p>
  
  <ul>
  <li>The function call is in a button click event handler, so it happens after the page (and the script) have been loaded)</li>
  </ul>