Skip to content
Advertisement

Iframe load event fires twice

The function bound to (@load="myFunction") fires once when the iframe is created and once when it’s actually loaded.

Why does it fire when the iframe is created, and how to avoid it?

JavaScript

Advertisement

Answer

As @tao suggested something else was interefering, namely Nuxt Lazy Load package. So if anyone uses this package AND finds out iframes onload event mysteriously fires twice AND finds this thread:

Add iframes: false in your nuxt.config.js when importing the package inside the modules section. Problem solved!

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement