Open tw77 opened 2 years ago
See https://www.thisdot.co/blog/using-message-events-to-resize-an-iframe for similar idea/implementation
That looks promising. The same faculty member expresses interest in an iFrame size listener for all whitelisted sites rather than only MyOpenMath.
Love this!
A user inquired about the progress on this issue and pointed out this resource.
Hmm... Does that mean any iFramed webpage that can send a JSON postMessage string, not just the one in OP, can be dynamically adjusted for height with Adding Support For A Non-oEmbed Site with wp_embed_register_handler() by reading the JSON info received?
Feature Description
A faculty member at Montgomery College points out that iFrame embeds of MyOpenMath content in Pressbooks don't change height on window resize or other events. They're wondering if this resizing could be supported: "MyOpenMath does send a JSON postMessage string that includes the height of the iFrame and its wrapper element. Can we possibly implement a postMessage listener on PB to read the height sent by the MyOpenMath?"
They've included a demo of the desired resizing effect on Stackblitz. "If you hit Submit, the iFrame is resized. Click on Try a similar question to get to the original size for that question."
Feature Use Case
Allowing for resizing the iFrame embed in response to events will support the use of MyOpenMath content by instructors in their books.