0

我有一个不允许(也不应该)在 iPad 上缩放的网页。一切都很好,除了在 Safari 中打开多个选项卡的情况下:

    1. have focus on my application's tab
    2. change to a different tab
    3. switch the iPad's orientation (i.e. portrait to landscape or vice versa)
    4. switch back to my web apps tab

在许多情况下,iPad 会放大,我无法重置缩放。由于我通过视口元标记禁用了缩放,因此缩放不应该改变。让事情变得更奇怪:如果我刷新页面或什至导航到其他一些网站,Zoom 将不会刷新。

我也注意到这发生在其他网站上。我已经尝试了所有可以想象的元标记组合(禁用缩放)。我正在使用 iPad 3 进行测试。如果我在 Safari 中只打开一个选项卡,我没有任何问题。

这似乎与“著名”方向问题无关,因为当应用程序没有焦点时会发生不希望的缩放 如何在 iPhone 上的方向更改时重置 Web 应用程序的缩放/缩放?

4

1 回答 1

0

这是我解决此问题的方法:

1. use the onorientationchange event to detect if the zoom is changed
2. if the zoom has changed change the viewport meta tag to: user-scalable=yes
3. on $(window).resize or onorientationchange change viewport back to user-scalable=no if the user has changed the zoom back to fit the screen
于 2012-08-26T22:08:19.020 回答