I am trying to use Modernizr to detect whether or not viewport units are supported in the browser.
Here is my test:
if(!Modernizr.cssvhunit) {
alert('viewport units are not supported');
}
I am aware viewport units are not supported in iOS7, so this is where I need a fallback.
When I load a page in iOS7 on an iPad in landscape orientation, the alert is executed.
However, if I load the page in portrait orientation, I don't see the alert.
Why does the condition only work in landscape? Is this a known bug with Modernizr?
I don't have an answer but I did figure out an alternative solution.
I added a test for cssvmaxunit and the condition works in both portrait and landscape.
I figure if the browser doesn't support
vmax
, then it likely doesn't supportvh
.