title: How to debug JavaScript code of a page from WPF WebBrowser Control
body: <p>I have a WPF WebBrowser control which I used in my wpf client application to navigate to different pages. It has basic functionalities like back , forward , go events which calls this.webbrowser.goback(), this.webbrowser.goforward(), this.webbrowser.go().</p>
  
  <p>Though the web application works fine with IE which means all the forward and back navigations for more than one level .More than one level navigation doesn't work fine in my WPF application for one page(Billings which has contacts link and in contacts page we have address link.) when clicking back button on my address page it goes to contacts page but clicking back button on contacts page doesn't go to billing page.</p>
  
  <p>Since it's working fine in IE without any issues I suspect there is something wrong with my WPF applications . I have few questions here .</p>
  
  <ol>
  <li>Is the webbrowser.goback() same as click back button of IE ? Or any events will be missed out in the wpf webbrowser control compared to IE ?</li>
  <li>IS there a way we can debug the javasctipts from WPF application itself ?</li>
  <li>Is there a better way to debug these kind of scenarios from WPF applications ?</li>
  <li>Does IE stores the WPF WebBrowser navigations in its history or it is a separate instance ?</li>
  </ol>
  
  <p>my control looks like below </p>
  
  <pre><code>&lt;WebBrowser x:Name="webBrowser" DockPanel.Dock="Bottom" Navigating="webBrowser_Navigating" Navigated="webBrowser_Navigated" LoadCompleted="webBrowser_LoadCompleted"/&gt;
  </code></pre>
  
  <p>And code behind looks like below:</p>
  
  <pre><code>private void backButton_Click(object sender, RoutedEventArgs e)
      {
          // Navigate to the previous HTML document, if there is one
          if (this.webBrowser.CanGoBack)
          {
              this.webBrowser.GoBack();
          }
          else
          {
              MessageBox.Show("Cannot go back. There needs to be something in the history to go back to.");
          }
      }
      private void forwardButton_Click(object sender, RoutedEventArgs e)
      {
          // Navigate to the next HTML document, if there is one
          if (this.webBrowser.CanGoForward)
          {
              this.webBrowser.GoForward();
          }
          else
          {
              MessageBox.Show("Cannot go Forward. There needs to be something in the history to go forward to.");
          }
      }
  </code></pre>