Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Fix iOS 7 iPad Safari Landscape innerHeight/outerHeight layout issue
* Add ipad IOS7 Classes
* Allows us to temporariliy try to fix the slight scroll 100% hack.
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) {
$('html').addClass('ipad ios7');
* Fix for iPad iOS7 slight scroll on 100% body height
@media (orientation:landscape) {
html.ipad.ios7 > body {
position: fixed;
bottom: 0;
width: 100%;
height: 672px !important;

This comment has been minimized.

Copy link

@jandelvo jandelvo commented Feb 26, 2014

Many Thanks for your solution: it works.
I simply suggest to set height to match window.innerHeight and not a fixed value.
Setting fixed height leave a white band on full screen browser mode.
Something like this will works on full screen too (no jQuery needs) and chances are it will work even in case of an iOS fix:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
html { position: fixed; top: 0px; bottom: 0px; width: 100%; }


<script type="text/javascript">
if (navigator.userAgent.match(/iPad;._CPU.OS 7\d/i))
document.getElementsByTagName("html")[0].style.height = window.innerHeight +"px !important";


This comment has been minimized.

Copy link

@undless undless commented Jul 22, 2014


This trick worked perfectly for me too. Thanks benhuson.

jandelvo i think understand your point but for the moment there is no fullscreen mode on ipad IO7. But you're right, we should make it flexible.
I just suggest to add an orientation detection to your code because your code is setting a height even on portrait (the css use the media querie orientation:landscape).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment