Skip to content

Instantly share code, notes, and snippets.

@techsin
Forked from jaydson/gist:1780598
Created January 23, 2016 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techsin/224136a4406a3b13bc16 to your computer and use it in GitHub Desktop.
Save techsin/224136a4406a3b13bc16 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