Gags
Gags

Reputation: 3829

disable viewport zoom iOS10 safari?

I've tried all three of these but no luck:

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; 
user-scalable=0;" />

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; 
user-scalable=false;" />

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; 
user-scalable=no;" />

Each are different values I found recommended by google searching or SO searching, but none of the 'user-scalable=X' values seem to be working

I also tried comma delimiting the values instead of semicolon, no luck. Then I tried ONLY having the user-scalable value present, still no luck.

Apple Says this

To improve accessibility on websites in Safari, users can now pinch-to-zoom even when a website sets user-scalable=no in the viewport.

Also tried:

<meta name="HandheldFriendly" content="true">
html {
   -webkit-text-size-adjust: none
}

Tried Javascript as well

document.documentElement.addEventListener('touchmove', function (event) {
      event.preventDefault();      
}, false);

Javascript solution worked but it disables horizontal scroll as well. :(

none of above is working. Any ideas?

Upvotes: 0

Views: 4057

Answers (1)

lifwanian
lifwanian

Reputation: 654

This should work until Apple comes to their senses and stops removing features we all use...

document.documentElement.addEventListener('gesturestart', function (event) {
    event.preventDefault();      
}, false);

Upvotes: 3

Related Questions