Title: Handling Post-Iframe Load Scripts
Last modified: October 17, 2025

---

# Handling Post-Iframe Load Scripts

 *  Resolved [arypneta](https://wordpress.org/support/users/arypneta/)
 * (@arypneta)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/handling-post-iframe-load-scripts/)
 * We have some scripts that run on the load of certain iframes to perform various
   tasks (mainly iframe resizing). Right now they initialize with the jQuery ready
   function or the standard DOMContentLoaded event. Without embed privacy, the iframes
   are loaded when the page loads and the scripts trigger to resize as expected.
 * However, with Embed Privacy, the iframes don’t actually exist unless the user
   has previously approved the content or until they click to approve the content
   on the page. When they click to approve content, that then loads the iframe, 
   but because the page is already ready/loaded, it doesn’t run the other scripts
   again (like iframe resizing).
 * I may be overlooking something obvious, but do you have any suggestions on how
   to deal with that? My initial thought was that if Embed Privacy has some kind
   of event for “content approved/loaded” I could add that to our scripts and re-
   call the iframe loading scripts when the iframe is actually loaded.
 * Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Matthias Kittsteiner](https://wordpress.org/support/users/kittmedia/)
 * (@kittmedia)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/handling-post-iframe-load-scripts/#post-18686187)
 * Hi [@arypneta](https://wordpress.org/support/users/arypneta/),
 * currently, Embed Privacy does not provide a custom event to listen to on activation.
   As a workaround, you can add a click event listener to every `.embed-privacy-
   overlay`, ideally set a short timeout of a few milliseconds to make sure the 
   click event of Embed Privacy has already been processed, and then query for the
   iframe inside and execute your logic.
 * Alternatively, you can use a `MutationObserver` and check for changes there.
 * Hope that helps.
 * Best regards,
   Matthias
 *  Thread Starter [arypneta](https://wordpress.org/support/users/arypneta/)
 * (@arypneta)
 * [7 months, 1 week ago](https://wordpress.org/support/topic/handling-post-iframe-load-scripts/#post-18688300)
 * Thanks for the suggestions, Matthias! I think the click listener will probably
   do what we want, so that’s helpful to know the right class name to target.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Handling Post-Iframe Load Scripts’ is closed to new replies.

 * ![](https://ps.w.org/embed-privacy/assets/icon.svg?rev=2812349)
 * [Embed Privacy](https://wordpress.org/plugins/embed-privacy/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/embed-privacy/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/embed-privacy/)
 * [Active Topics](https://wordpress.org/support/plugin/embed-privacy/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/embed-privacy/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/embed-privacy/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [arypneta](https://wordpress.org/support/users/arypneta/)
 * Last activity: [7 months, 1 week ago](https://wordpress.org/support/topic/handling-post-iframe-load-scripts/#post-18688300)
 * Status: resolved