[Feature Request] Add onResizeError callback
raldred opened this issue · 4 comments
It would be useful to know if there is an error resizing the frame.
This would allow us to handle this appropriately as without resizing the page maybe appear broken to the end user.
Could we add an onResizeError
or similar callback?
Not sure how to detect such an error. If you make a PR I’m happy to consider including it.
My initial thought would be to add a callback for the warning that gets logged out if the parents script doesn't hear back from the content.
https://github.com/davidjbradshaw/iframe-resizer/blob/master/src/iframeResizer.js#L885
in that case maybe onTimeout
?
That's a warning rather than an error. You can get this message and everything still work. It's there to stop people raising tickets when they forget to add the JS into the iframe. But it can also be triggered by an iFrame just being slow to load.
If your worried about slow loading you can add so JS in your iFrame to send a message to the parent page when it is ready.
Maybe an onIframeReady event in the parent page would be more useful?
Thinking a bit more we already have an onReady function, it's called onInit()