Detecting iframe removed by parent

Asked By: Anonymous

I have a web application that is embedded in an iframe by external sites, of which we have no control over.

Is there a way to detect when the iframe element has been removed from the dom of the parent, in order to perform some cleanup before it’s gone? It appears to fire a "visibilitychange" event, but I need to differentiate this between visible, hidden and removed.


Solution

Answered By: Anonymous

The solution was listening for the "pagehide" lifecycle event. I already had a handler setup for "beforeunload" but for whatever reason, it isn’t called in this instance, and my use case was too early for "unload".

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno