javascript - 如何让 iPhone 大小的网页显示正确的大小?

标签 javascript css iphone mobile-safari

我正在为网站创建多个页面的 iphone 版本,我正在使用 javascript 文件重定向到正确的页面:

<script type="text/javascript">// <![CDATA[
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
location.replace("index2.html");
// ]]></script>

The page加载正常,但它在屏幕上非常小。

我需要做什么才能让它填满 iPhone 的屏幕?

这是 html:

<!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="description" content="Advantage Total Agency Management" />
<meta name="keywords" content="Advantage" />
<meta name="author" content="Advantage" />

<link rel="stylesheet" type="text/css" media="screen" href="_css/mobile.css"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<title>Mobile Home | Go To Advantage</title>
</head>
<body id="home">
<div id="header">
    <a href="/"><img src="_images/logo.png" alt="Advantage Software" /></a>
    <ul>
        <li><a class="home" href="index.html">home</a></li>
        <li><a class="services" href="services.html">services</a></li>
        <li><a class="contact" href="contact.html">contact</a></li>
    </ul>
</div>
<div id="intro">
    <img src="_images/quote.png" alt="We work the way you work" />
    <p>Advantage is integrated software for Advertising, Marketing, Public Relations, Media Buying and related organizations that is robust, flexible, browser-based, and mobile.</p>
</div>
<div id="text">
    <p>Our software products meet the needs of mid to large-size agencies but also smaller agencies with a streamlined and efficient design. Our role-based methodology ensures that every individual in the agency benefits from the software. Our Advantage suite of agency software products streamline agency workflow and internal processes.</p>
</div>
<div id="footer">
    <ul>
        <li><a class="call">call</a></li>
        <li><a class="email">email</a></li>
        <li><a class="demo">demo</a></li>
    </ul>
</div>
</body>
</html>

最佳答案

关于javascript - 如何让 iPhone 大小的网页显示正确的大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3212675/

相关文章:

javascript - 你如何使用 Facebook React 管理组件依赖顺序?

php - 计算 Ubuntu 中的逻辑代码行

iphone - 单击时 HTML5 下拉菜单未隐藏在 iPhone 模拟器中

iphone - 如何仅隐藏/禁用第一个 uinavigationbar?

javascript - 仅缩放图像 JQuery 的点击部分

ios - 杀死翻转开关中的应用程序

javascript - 在 typeahead-on-select 之后关注其他输入 angular-ui-bootstrap

JavaScript 租赁日期逻辑

javascript - $ ('.class' ).on 和 $(document).on 在 jquery 中的区别

CSS 故障 : Float drops to another line (all browsers)