hi to everyone.
i'm newbie to XPCOM and faced with problem of getting current url from page
and control over navigation. We decided to use nsIWebNavigation interface
for these purposes.
below is our code:
nsIWebNavigation * nsWN = NULL;
if (gServiceManager)
{
nsresult res;
res = gServiceManager->GetServiceByContractID("@mozilla.org/embedding/browser/nsWebBrowser;1",
NS_GET_IID(nsIWebNavigation), (void **)&nsWN);
if(NS_OK == res)
{
MessageBox(NULL, "Interface Pointer Received Succesfully", "WebNavigation",
MB_OK);
nsIURI *url = NULL;
res = nsWN->GetCurrentURI(&url); //res =
NS_ERROR_UNEXPECTED
if(NS_OK == res)
MessageBox(NULL, "URI received", "URI msg", MB_OK);
res = nsWN->GetReferringURI(&url); //res =
NS_ERROR_UNEXPECTED
if(NS_OK == res)
MessageBox(NULL, "URI REF received", "URI msg", MB_OK);
nsEmbedCString path;
if(url)
url->GetPath(path);
MessageBox(NULL, path.get(), "path of page", MB_OK);
}
else if (NS_NOINTERFACE == res)
MessageBox(NULL, "NOINTERFACE", "WebNavigation", MB_OK);
}
NS_IF_RELEASE(nsWN);
-------------------------
With Best Regards,
Anatoly Kaverin,
VerificationEngine developer
http://www.vengine.com
C O M O D O group
[EMAIL PROTECTED]
MSN: [EMAIL PROTECTED]
_______________________________________________
Mozilla-xpcom mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-xpcom