I've got an HTML page (the parent) with an embedded IFRAME. The parent page has a couple of event listeners for mouse and keyboard events, as shown below (I'm using the Prototype library).
var IdleMonitor = Class.create({
active: null,
initialize: function(ii) {
Element.observe(window, "mousemove", this.sendActiveSignal.bind(this));
},
sendActiveSignal: function() {
console.log("MOUSE");
}
});
var idleMonitor = new IdleMonitor();
The IFRAME, being a separate document and all, doesn't respond to the parent's events. So I've set up some code in the IFRAME like:
<script type="text/javascript" >
Element.observe(window, "mousemove", function(p) {
parent.sendActiveSignal();
});
</script>
But that's giving me an error (sendActiveSignal is an undefined function). How do I make the IFRAME also listen for the same events and fire the parent's event handlers, preferably in a Prototype-y way?