[Greasemonkey] How to check whether a page has keyboard handler attached?

Anton Berezin tobez at tobez.org
Wed Oct 26 10:22:36 EDT 2005


On Tue, Oct 25, 2005 at 09:37:14PM -0500, Jeremy Dunck wrote:
> On 10/25/05, comex <comexk at gmail.com> wrote:
> > >   if (body.onkeydown) ...
> > >   if (body.onkeypress) ...
> > >   if (typeof body.onkeypress != undefined) ...
> > >
> > > and variants, but that did not seem to work.
> > Maybe document.body rather than body?
> 
> Assuming you're using GM 0.5 or higher, try this:
> unsafeWindow.document.body.on*

Er, I forgot to mention that body variable was obtained with

 var body = unsafeWindow.document.getElementsByTagName("body")[0];

It just looks like on* things are not reflected in body's properties.
Is there another way?

\Anton.
-- 
An undefined problem has an infinite number of solutions.
-- Robert A. Humphrey


More information about the Greasemonkey mailing list