Last active
April 29, 2021 22:40
-
-
Save karlazz/0bac0b59e9b5c7b7797b1601a30ba12f to your computer and use it in GitHub Desktop.
Detect onclick event in iframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clickIframe = window.setInterval(checkFocus, 100); | |
var i = 0; | |
function checkFocus() { | |
if(document.activeElement == document.getElementById("ifr")) { | |
console.log("clicked "+(i++)); | |
window.focus(); | |
} | |
} | |
// https://stackoverflow.com/questions/29337304/how-to-detect-a-click-inside-of-an-iframe-cross-domain-aka-prevent-click-frau |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment