如何禁用Mobile Safari上的视口缩放? [英] How do you disable viewport zooming on Mobile Safari?
问题描述
我尝试了所有这三种方法都无济于事:
< meta name =viewportcontent =宽度=设备宽度;初始规模= 1.0;最大规模= 1.0; user-scalable = 0;/>
< meta name =viewportcontent =width = device-width;初始规模= 1.0;最大规模= 1.0; user-scalable = false;/>
< meta name =viewportcontent =width = device-width;初始规模= 1.0;最大规模= 1.0; user-scalable = no;/>
每个值都是我通过google搜索或SO搜索推荐的不同值,但没有一个'user-可伸缩= X'值似乎正在工作
我也尝试用逗号分隔值而不是分号,没有运气。然后,我试着只用户可扩展的值存在,仍然没有运气。
更新
从苹果网站得到这个信息,它可以工作:
< meta name =viewportcontent =width = device-width,user-scalable = no/>
事实证明,问题在于非标准引号,因为我已经将元标记从使用它们的网站,whoops
您的代码显示属性双引号为花式双引号。如果您的实际源代码中出现了花哨的引号,我想这就是问题所在。
这适用于iOS 4.2中的Mobile Safari。
< meta name =viewportcontent =width = device-width,initial-scale = 1.0,maximum-scale = 1.0,user- scalable = no/>
I've tried all three of these to no avail:
<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.
UPDATE
Got this from Apple's site and it works:
<meta name="viewport" content="width=device-width, user-scalable=no" />
it turns out that the problem was the non-standard quotes because I had copied the meta tag from a website that was using them, whoops
Your code is displaying attribute double quotes as fancy double quotes. If the fancy quotes are present in your actual source code I would guess that is the problem.
This works for me on Mobile Safari in iOS 4.2.
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
这篇关于如何禁用Mobile Safari上的视口缩放?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!