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?

fiddle

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; } 

new fiddle

please note user not able interact iframe way.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -