Jon Roig wrote:
How can I tell if the current page a user is looking at is fully
loaded? (In Firefox, from an extension....)

  -- jon

--
jon roig
web developer
http://jonroig.com
_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom



This code will do the job.

NS_IMETHODIMP DOMPilot::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
{
   nsCOMPtr<nsIObserverService> observerService;
rv = servMan->GetServiceByContractID( "@mozilla.org/observer-service;1",
                                   NS_GET_IID(nsIObserverService),
                                   getter_AddRefs(observerService));
       if (NS_SUCCEEDED(rv))
{ observerService->AddObserver(this, "xpcom-shutdown", PR_TRUE);
           observerService->AddObserver(this, "EndDocumentLoad", PR_TRUE);
       }


   if (strcmp(aTopic, "EndDocumentLoad") == 0)
   {
       nsCOMPtr<nsIDOMWindow> topWindow(do_QueryInterface(aSubject));
       nsCOMPtr<nsIDOMDocument> doc;
       topWindow->GetDocument(getter_AddRefs(doc));

       nsCOMPtr<nsIDOMElement> relem;
       doc->GetDocumentElement(getter_AddRefs(relem));
   }
}

Steve


_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to