What\'s the correct way of detecting when an iframe gets or loses focus (i.e. will or will not receive keyboard events)? The following is not working in Fx4:
This might work
document.addEventListener('click', function(event) { var frame= document.getElementById("yourFrameID"); var isClickInsideFrame = frame.contains(event.target); if (!isClickInsideFrame ) { //exec code } });