3 ms·
The real problem with iframes is that their size is set by the parent document only. They would be a lot more useful if we could write e.g. <iframe src=abc.htm
by silvestrov 1y ago
The real problem with iframes is that their size is set by the parent document only.
They would be a lot more useful if we could write e.g. <iframe src=abc.html height=auto width=100> so the height of the iframe element is set by the abc.html document instead of the parent document.
- baggy_trough 1y agoYou can achieve that with js in the parent document.
- teg4n_ 1y agoYou can achieve everything with JS in the parent document, it doesn’t mean it should be required or even recommended
- baggy_trough 1y agoWe could also achieve it with single tape Turing machines, but with js in the parent document it takes just a few lines and is practical to do.
- jefftk 1y agoYou could do this with js in the child document, if its important to keep js out of the parent.
- silvestrov 1y agono, not if it is cross site URL. Then you need a postMessage to send body size to parent frame which then needs to listen for messages and resize the iframe element.
- jefftk 1y agoTotally! I thought we were talking about the same site case.