Newsgroups: mozilla.dev.tech.xul
From: Martin Lutken <mlut...@gmail.com>
Date: Tue, 17 May 2011 08:43:07 -0700 (PDT)
Local: Tues, May 17 2011 11:43 am
Subject: Re: DOMContentLoaded event from C++
Hi Neil
I'll try your way too. Again Thanks a lot :) I found the solution. Just need to get the Parent windows of the one I void CSpecialThing::getBrowserQuestionForForum() // --- A lot of variables --- // ----------------------------- nsCOMPtr<nsIWindowMediator> nsString sWindowType( NS_LITERAL_STRING("") ); PRBool bHasMoreElements; while ( bHasMoreElements ) { rv = pWinInternal- >GetLocation( getter_AddRefs(pDOMLocation) ); nsString wsHrefTest; rv = pDOMLocation->GetHref( wsHrefTest ); // See if we have the correct (XUL) URI rv = pWinEnumerator->HasMoreElements( &bHasMoreElements ); // --- Get the "mybrowser1" element --- pDomWin->GetParent( getter_AddRefs(pDomWinBrowser) ); // --- Add events --- >AddEventListener(NS_LITERAL_STRING("DOMContentLoaded"), this, PR_FALSE); pDomEventTargetBrowser- >AddEventListener(NS_LITERAL_STRING("resize"), this, PR_FALSE); pDomEventTargetBrowserWin- >AddEventListener(NS_LITERAL_STRING("unload"), this, PR_FALSE); // --------------------------------------------------------------- // --- Bonus example on how to get the current URI of the page --- // --------------------------------------------------------------- pDomWin->GetDocument( getter_AddRefs(pDomDoc) ); nsCOMPtr<nsIDOMDocumentView> pDomDocumentView(do_QueryInterface(pDomDoc)); nsCOMPtr<nsIDOMAbstractView> domAbstractView = getDefaultView(pDomDocumentView); nsCOMPtr<nsIWebNavigation> webNavigation(do_GetInterface(domAbstractView)); printf("webNavigation uri: %s\n", getCurrentURI(webNavigation).c_str() ); }
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||