Refining on the window.scrollTo(0,0)
solution, I encapsulate in a self describing immediately invoked function expression and execute on document ready and window resize:
(function minimalUiFix() {
var fix = function () {
window.scrollTo(0,0);
};
$(fix);
$(window).on('resize.minimal-ui-fix', fix);
})();
The benefit is that all the code related to the work around encapsulated together and the reason for the work around is described in the function name. This protects the rest of my beautiful code from being contaminated (too much) by strange work arounds.
There's a lot going on, but I'm using it in this jsbin.
This trick doesn't seem to do the trick for me. Check out this jsbin. What I have here is pretty simple: a fixed position container with overflow hidden that should take up the whole screen. Scrolling should not be possible, however, I'm still getting some unintended scrollable space. All this trick does is scroll back to the top. It doesn't eliminate the mysterious extra space that is causing the real problem.
But, applying the fix on scroll in addition to ready and resize seems to the be closest to decent work around I could find.
(function minimalUiFix() {
var fix = function () { window.scrollTo(0,0); };
$(fix);
$(window).on('resize.minimal-ui-fix', fix);
$(window).on('scroll.minimal-ui-fix', fix);
})();
I think this is the best we can hope for until Apple fixes Mobile Safari or another work around is discovered.