Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



You could do this with js in the child document, if its important to keep js out of the parent.


no, 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.


Totally! I thought we were talking about the same site case.


You can achieve that with js in the parent document.


You can achieve everything with JS in the parent document, it doesn’t mean it should be required or even recommended


We 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: