Is there a reason it needs to be detected within the iframe? Because you could try detecting the input in the parent window and checking if the iframe is active.