Navigating the browser << Previous |  Contents  |  Next >>  ]
Navigating the browser Implemented by Gecko and provides methods for...
  • back/forward, canGoBack/canGoForward.
  • URI loading, stoping, reloading.
  • The currently loaded URI.
  • the nsISHistory (session history) interface bound to this nsWebBrowser.

This snippet will cause a URL to be loaded by Gecko. The contents will be rendered in the window you just setup.
  #include "nsIWebNavigation.h"

  nsCOMPtr<nsIWebNavigation> webNav = do_QueryInterface(webBrowser);

  // Load a URI.
  rv = webNav->LoadURI(
         nsnull, nsnull, nsnull); // referrer, postdata & headers
  if (NS_FAILED(rv)) return rv;