nodeca/tabex

Tabex with iframe doesn't work when loaded after DOMContentLoaded event

Closed this issue · 1 comments

Tabex, when configured with cross-domain via iframe, doesn't work when it was injected on the page after DOMContentLoaded event.

That's because this event was already fired, and won't fire never: https://github.com/nodeca/tabex/blob/master/lib/tunnel.js#L82, so no iframe is injected, no communication in tabex.

As possible fix we can check window.readyState and listen event only if it's loading.

Honestly, i'm not strong in browser programming. Could you do PR with right check?

PS. Also see "known problems" in Readme. Cross-domain messaging will suck in Safary and IE.