Re: How to get current instance (nsIWebNavigation) of mozilla?
"Mozilla.embedding" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.xpinstall |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <cd8ikf$prk1__2696.00585238567$1089982040$gmane$org@ripley.netscape.com> |
to get the domDocumen, you must load the web page like this :
"nsresult navrv
=webNav->LoadURI(NS_ConvertASCIItoUCS2(url).get(),nsIWebNavigation::LOAD_FLA
GS_NONE,
nsnull, nsnull,
nsnull);"
And then, you must register and implement a nsiWebBrowserChrome listener :
inside your nsiWebBrowerChrome, you will be able to
test the end of loading and finally get the domDocument.
--
Béatrice Philippe
[email protected]
"yueweng" <[email protected]> a écrit dans le message de
news:[email protected]...
> Dear all,
>
> I am wondering how do I get the instance of current browser,
> mWebBrower or webNav (see below). My code current hook on Mozilla.exe
> using nsIWebProgressListener? I would like to use the browser
> instance to do the following:
>
> nsCOMPtr<nsIWebNavigation> webNav(do_QueryInterface(mWebBrower));
> nsCOMPtr<nsIDOMDocument> domDocument;
> webNav->GetDocument(getter_AddRefs(domDocument));
> nsCOMPtr<nsIDOMHTMLDocument>
> htmlDomDocument(do_QueryInterface(domDocument));
> nsString title;
> res = htmlDomDocument->GetTitle(title);
>
> Regards,
> yueweng