The iPhone X landscape default safe area and notch solution.
I added this Question to help others avoid a headache I head trying to fix my website on the new iPhone 10
Basically, the problem is white bars
The iPhone X landscape default safe area and notch solution.
I added this Question to help others avoid a headache I head trying to fix my website on the new iPhone 10
Basically, the problem is white bars
Notes: In iOS UIWebView, the screen.availHeight is equal to 768. In iOS WKWebView, the screen.availHeight is always 812.
The solution is to use
viewport-fit=cover
This will use the full screen but what about the notch.
create a class
and add it to the website wrapper and done? Yes
No. Full-width images and Full-width divs with different colors will be cut
on my website, I use
<section>
to add background images or colors and add a div in the section for the content, so instead of.iphoneX
on the website wrapper, i added.iphoneX_rl
on the divThat takes care of the right and left what about the bottom
.iphoneX_footer{ padding: 0 0 constant(safe-area-inset-bottom) 0
}
add this to -the last div ( container) in your footer
now my website looks good on iPhone X/10, looking at my website on the iPhone 8 content goes to the edge? no safe area time for js/jquery
navigator.userAgent.match(/(iPhone)/)
if any iPhone(screen.availHeight == 812) && (screen.availWidth == 375)
if iPhone 10((window.innerHeight == "375") && (window.innerWidth == "812"))
if landscapedoes your website use google maps Add this to landscape
$('#map_section').addClass("gm_iphoneX");
class
if there is a better way to do it, or I missed something tell me THANKS