Re: [csswg-drafts] [css-sizing] Auto-resize iframes based on content (#1771)

> Is there precedent for this in libraries/frameworks/userland?

There are indeed various libraries that do it. Here are some examples / related links:

https://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content
http://blog.apps.npr.org/pym.js/
https://github.com/whatwg/html/issues/555 (contains more links to libraries implementing the functionality).
The Disqus team also asked for it [way back when](https://lists.w3.org/Archives/Public/public-whatwg-archive/2014Feb/0015.html).

I think this is a very common situation also in ads, where the creative may change its sizing and request adjustment in the parent page.

Those comments are also asking for automatic resizing without script in some cases, based on the intrinsic sizing of the iframe content.

> It seems you could already do this with `postMessage()` if you wanted to.

Yes you can, and developers do it. The reason I think this should be a built-in API are:
* Common use-case: it will help out developers avoid busywork and unnecessary extra script
* Third-party coordination: it will help third-party iframes use a compatible API with multiple embedding pages without problems
* UA integration: allows the resize to be controlled by the user agent, based on policies such as the iframe being offscreen or throttled (these integrations could be specified as add-ons)


-- 
GitHub Notification of comment by chrishtr
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1771#issuecomment-805158391 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 23 March 2021 19:05:58 UTC