You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



nsIWebNavigation and snippet [ << Previous | Contents | Next >> ]
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(
         NS_ConvertASCIItoUCS2("www.mozilla.org").get(),
         LOAD_FLAGS_NONE);
  if (NS_FAILED(rv)) return rv;