-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Iframe load event not firing in Chrome and Safari when src is 'about:blank' #6541
Comments
Unlike in #5332, this does appear to fire in chrome (http://jsfiddle.net/x14c21g0/) so it's odd that we're not firing the event in React. |
+1 |
+1 |
+1 |
Please don‘t +1. If you’d like to see this fixed, please help figure out why this happens and/or contribute a fix. |
I am experiencing this issue as well with |
So the reason that we don't dispatch is because the There's some context on this in whatwg/html#490. There's ambiguity in the spec around Outside of waiting for WATWG and browser vendors to resolve this ambiguity, resolving this would probably involve implementing a event queue that enqueues a subset of events during the commit phase and dispatches them afterwards. |
This is how I fixed this very issue :
As @aweary explained, the iframe's load event is fired before React can attach the listener to it. I got a hint of this when the |
Expanding on the suggestion from @yanickrochon... Let me introduce you to react-onload-iframe: iframe wrapper component that enables onLoad event handling in all browsers. NPM: https://www.npmjs.com/package/react-onload-iframe Github: https://github.com/TheJanitor337/react-onload-iframe Example: https://react-ts-av8uan.stackblitz.io P.S. |
See: https://jsfiddle.net/pnct6b7r/
It will not trigger the alert in Chrome and Safari, but it will work in Firefox and even IE8.
Is this a React issue or Webkit issue? If it is a Webkit issue, should we "fix it" in React given that we want consistent events across browsers?
ps: The JSFiddle was based on the isuse #5332.
The text was updated successfully, but these errors were encountered: