views:

931

answers:

1

I have a script in an iframe that listens for movements of the mouse from document.body as follows:

$(document.body).addEvent('mousemove',this.refresh.bind(this));

This works fine from within the IFrame, but I want to also track that the mouse is being moved outside of the Iframe. Anyway to do this? I am using MooTools.

A: 

The script in your iframe may or may not be allowed access to the parent. If the parent is in the same domain, it will.

In that case, you should be able to use something like this:

$(parent.document.body).addEvent('mousemove',this.refresh.bind(this));

This would capture any mouse movement within the parent window. "parent" is a property of "window" that is a reference to the "window" object of the parent iframe.

Renesis