This file contains 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
// Add focus on current window | |
window.focus(); | |
// When click on iframe the focus change and we are listen this | |
var listener = window.addEventListener('blur', function() { | |
//console.log('active == iFrame: ', document.activeElement == document.querySelector('iframe[title="Help Scout Beacon"]')); | |
// if the current focus is on your iFrame (you can use any css or js selector here) | |
if (document.activeElement == document.querySelector('iframe')) { |