The problem with all these solutions is that the height of the iframe
never really changes.
This means you won't be able to center elements inside the iframe
using Javascript, position:fixed;
, or position:absolute;
since the iframe
itself never scrolls.
My solution detailed here is to wrap all the content of the iframe inside a div
using this CSS:
#wrap {
position: fixed;
top: 0;
right:0;
bottom:0;
left: 0;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
This way Safari believes the content has no height and lets you assign the height of the iframe
properly. This also allows you to position elements in any way you wish.