Note that there are some explanatory texts on larger screens.

plurals
  1. POHow would I go about detecting onclick events external to a particular iframe?
    primarykey
    data
    text
    <p>I have a page that has a bunch of different iframes (A, B, C, D) - all of which are fully visible at all times. Together, they make up the various portions of my application's UI. One of these iframes, iframe D - houses another, smaller iframe (iframe X) that is sometimes made visible by a user action. It should automatically disappear whenever the user clicks outside of it. I can easily handle this from within iframe D by putting an onclick on the body. If I actually detect a click in iframe D's body - that means they aren't clicking in iframe X, so I can hide iframe X via CSS. No problem. </p> <p>The problem is the other iframes - A, B, and C. If a user clicks within those, I want to hide iframe X also. Currently, I have it working - but not well. For each of those iframes (A, B, C), I have code that will communicate body clicks to iframe D. I don't like this approach because iframes A, B, C all have knowledge of iframe X - there really should be no need for this, and it just adds to files I have to change to support the feature offered by iframe X. <strong>Is there any way I can handle detecting external onclick events all from within iframe D?</strong> This would leave the iframe X show/hide logic within iframe D, which makes the code much easier to move around.</p> <p>If I get that onclick monitoring going - I'm also wondering if it would handle <em>all</em> clicks - for example, if iframe A has some onclick events set on specific elements - am I sure to also catch those clicks? I mention this because my current workaround seems to be flawed (iframes A, B, C report their body onclicks to iframe D) - certain clicks are not triggering body onclick.</p> <p>Thanks in advance guys. Please keep in mind, though, that removing iframes isn't realistic at this point in the project. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload