javascript - click event on a iframe wrapped element -
i may losing mind..
i have div element holding iframe. registered click event using javascript. click event not working when on iframe (grey region) when clicking outside region of iframe (blue region), click event working fine.
what should make click event work on iframe?
html:
<div id="main"> <iframe></iframe> </div>
javascript
var main = document.getelementbyid('main'); main.onclick = function () { alert('hello'); }
ps: iframe generating dynamically plugin, can't access code
you can add pointer-events: none;
iframe's css - way not capture clicks. supported in ff, safari, chrome, opera , ie11+.
modify fiddle:
iframe { pointer-events:none; width: 300px; height: 300px; border: 1px solid black; background-color: grey; }
please note user not able interact iframe way.
Comments
Post a Comment