Re: How to get nsIWebBrowser interface from a component?

Pete Collins <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Doug Turner wrote:
> Jacob Wong wrote:
> 
>> I have tried to get the nsIWebBrowser using the following code
>> nsCOMPtr<nsIWebBrowser>
>> pBrowser2(do_GetService("@mozilla.org/embedding/browser/nsWebBrowser;1")); 
>>
>> nsCOMPtr<nsIWebNavigation> spIWebNavigation1 = 
>> do_QueryInterface(pBrowser2);
>> nsCOMPtr<nsIURI> newUri;
>> res = NS_NewURI(getter_AddRefs(newUri), sUrl);
>> res = spIWebNavigation1->LoadURI(sUrl.get(),
>> nsIWebNavigation::LOAD_FLAGS_NONE);
>>
>> However, Netscape 6.2.x does not load the new url.  the return value is
>> 0x8000ffff.  That is unexpected error.  I also try to use
>>
>> res = spIWebNavigation1->GoBack();
>>
>> Netscape 6.2.x  does not go back to the previous page.
>>
>> Any idea what I have done wrong here?
>>
> 
> At what point do you make this call?  In your registerSelf callback?
> 

It seems he wants his component to load a URI into a preloaded window in 
Netscape 6.2.
So he would need to QI off an existing nsIDocShell or 
nsIDocShellTreeItem to do the load.

--pete
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.