Skip to content

Instantly share code, notes, and snippets.

@danhanfry
Forked from jaydson/gist:1780598
Created January 8, 2016 02:04
Show Gist options
  • Save danhanfry/b4c8af6b8d9a603beb83 to your computer and use it in GitHub Desktop.
Save danhanfry/b4c8af6b8d9a603beb83 to your computer and use it in GitHub Desktop.
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
myConfObj.iframeMouseOver = true;
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseout',function(){
myConfObj.iframeMouseOver = false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment