title: In a WebBrowser control, window.external is not available
body: <p>I'd like to call C# methods within a WebBrowser Control. Below is my code:</p>
  
  <p>In XAML,</p>
  
  <pre><code>&lt;phone:WebBrowser Margin="0,0,0,0" Name="WebBrowserForDetails" VerticalAlignment="Top" Height="300" ScriptNotify="WebBrowserForDetails_ScriptNotify" IsScriptEnabled="True" /&gt;
  </code></pre>
  
  <p>In C#,</p>
  
  <pre><code>protected override void OnNavigatedTo(NavigationEventArgs e)
  {
  
      string html = string.Format("&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;script type=\"text/javascript\"&gt;{0}&lt;/script&gt;&lt;/head&gt;&lt;body&gt;&lt;button onclick=\"call();\"&gt;Push&lt;/button&gt;", "function call(){ window.external.notify(123) ;}");
      WebBrowserForDetails.NavigateToString(html);
  }
  
  private void WebBrowserForDetails_ScriptNotify(Object sender, NotifyEventArgs e)
  {
      Debug.WriteLine(e.Value);
  }
  </code></pre>
  
  <p>Expected to see <code>123</code> in the debug window.</p>
  
  <p>When the <code>&lt;button&gt;Push&lt;/button&gt;</code> is pushed, <code>window.external.notify</code> is never called. In fact, <code>window.external</code> is not available. I would like to call the <code>window.external.notify</code> function from the WebBrowser control to call the <code>WebBrowserForDetails_ScriptNotify</code> method. What should I do?</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Reference links: <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.scriptnotify%28v=vs.95%29.aspx" rel="nofollow noreferrer">MSDN: <code>window.external.notify</code></a>, <a href="https://stackoverflow.com/questions/4684307/any-way-to-set-the-wp7-webbrowser-control-height-dynamically-and-lock-scrolling">Any way to set the WP7 Webbrowser control height Dynamically and lock scrolling?</a> and <a href="http://blogs.msdn.com/b/mikeormond/archive/2010/12/16/displaying-html-content-in-windows-phone-7.aspx" rel="nofollow noreferrer">Displaying HTML Content in Windows Phone 7</a></p>