开发者

Is 'user-scalable=no' broken with iPhone 4?

The following markup is so simple, I'm baffled as to why I'm able to scale in Safari on iPhone 4 when I shouldn't be able to. Any idea what I might be missing, or if this is a bug?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"开发者_运维知识库>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=640, user-scalable=no" />
<title>Title</title>
<style type="text/css">
<!--
body { padding:0; margin:0; }
-->
</style>
</head>

<body>

<a href="example.html"><img src="splash.jpg" width="640" height="960" alt="Click"></a>

</body>
</html>


I've had the same problem, some pages did work but my own not.

The Problem is the framing. If you frame the content (e.g. frame-forwarding by domain host) then the meta-tags aren't used.

There was my fault yesterday when I tried programming a WebApp.

Hope I could help


I thought you had to set width to be device-width but I might be wrong.


I'm not sure what you're aiming for here but if you want your page to go full-width (and no more) in both landscape and portrait view then try:

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


You're using xhtml closing tags, get rid of them and likely it will work. If not, add a preventDefault() handler to the body tag.

Note: Adding preventDefault(); will disable vertical scrolling as well.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜