Can anyone help?
I'm trying to install an event handler to catch JavaScript events.
Using the mfcembed example I've tried a number of permutations but none
work.
How I thought it might work is :-
#include "nsIJSEventListener.h"
#include "nsIDOMEventListener.h"
class CBrowserImpl : public nsIInterfaceRequestor,
public nsIEmbeddingSiteWindow,
.....
public nsIDOMEventListener,
public nsIJSEventListener,
public nsSupportsWeakReference
{
public:
CBrowserImpl();
~CBrowserImpl();
NS_METHOD Init(PBROWSERFRAMEGLUE pBrowserFrameGlue,
nsIWebBrowser* aWebBrowser);
NS_DECL_ISUPPORTS
NS_DECL_NSIINTERFACEREQUESTOR
NS_DECL_NSIEMBEDDINGSITEWINDOW
.........
NS_DECL_NSIDOMEVENTLISTENER
NS_IMETHOD GetEventTarget(nsIScriptContext** aContext, nsISupports**
aTarget);
NS_IMETHOD SetEventName(nsIAtom* aName);
......
}
nsresult CBrowserImpl::SetEventName(nsIAtom* aName)
{
......
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::GetEventTarget(nsIScriptContext**aContext,
nsISupports** aTarget)
{
.......
return NS_OK;
}
NS_IMETHODIMP CBrowserImpl::HandleEvent(nsIDOMEvent *event)
{
....
return NS_OK;
}
but - the callbacks are never called.
What is the correct method for capturing JavaScript events "outside" of the
scripts themselves ?
Many thanks
...Andy B.