【问题标题】:HTML5 global metatags/style for mobile app移动应用程序的 HTML5 全局元标记/样式
【发布时间】:2014-07-09 19:27:07
【问题描述】:

我是一名 C++ 开发人员,最近开始在我的移动应用程序中使用 HTML5,我对 Web 编程领域没有太多了解,我非常希望得到一些建议来微调我的元标记。

我需要适合 ios/android/windows phone/blackberry 等移动应用程序的完美元标记。

问题是我不确定我到底需要什么和不需要什么,这是我目前的清单:

html, body
{
     overflow: hidden;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-overflow-scrolling: none;
    -webkit-backface-visibility: hidden;
    -webkit-transition: translate3d(0,0,0);

    transition: translate3d(0,0,0);

    -webkit-font-smoothing: antialiased;
    font-smoothing: antialiased;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.004);
    -webkit-text-stroke: 1px

    -webkit-user-select: none; /* Chrome/Safari */        
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+ */

    /* Rules below not implemented in browsers yet */
    -o-user-select: none;
    user-select: none;

    margin: 0;
    padding: 0;
    border: 0;

    background-color:#202020;
}

* {margin:0; padding:0; border:0;}

<!DOCTYPE html>
<html>
    <head>
        <title>$Title</title>

        <meta charset="UTF-8">
        <meta name="keywords" content="Test">
        <meta name="description" content="Test">
        <meta name="subject" content="Test">
        <meta name="copyright" content="Test">
        <meta name="url" content="http://www.test.com">
        <meta name="language" content="en-GB">
        <meta name="robots" content="NOINDEX, NOFOLLOW">
        <meta name="pagename" content="$Title">
        <meta name="coverage" content="Worldwide">
        <meta name="distribution" content="Global">
        <meta name="target" content="all">
        <meta name="HandheldFriendly" content="True">
        <meta name="MobileOptimized" content="640">
        <meta name="format-detection" content="telephone=no">
        <meta http-equiv="cleartype" content="on">
        <meta name="apple-mobile-web-app-title" content="$Title">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-touch-fullscreen" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <meta name="ResourceLoaderDynamicStyles" content="">
        <meta http-equiv="Expires" content="0">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="imagetoolbar" content="no">
        <meta http-equiv="x-dns-prefetch-control" content="off">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

        <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8;" />

        <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">

        <!-- Makes your prototype chrome-less once bookmarked to your phone's home screen -->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">

        <!-- Set a shorter title for iOS6 devices when saved to home screen -->
        <meta name="apple-mobile-web-app-title" content="Ratchet">

        <script>
        document.ontouchmove = function(e)
        {
            e.preventDefault();
        }
        </script>

有什么建议吗?

【问题讨论】:

    标签: css html styles meta


    【解决方案1】:

    你需要:

    <meta charset="UTF-8">
    <title></title>
    <meta name="description" content="Test">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    

    - user-scalable=no" 这将阻止放大您的应用,我建议不要使用(糟糕的用户体验)

    <meta name="apple-mobile-web-app-title" content="$Title"> 
    

    - 如果您不想为此使用标题标签,则启动器标题。

    <meta name="apple-mobile-web-app-capable" content="yes"> 
    

    - 这将隐藏浏览器界面

    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    

    - 这将改变 ios 中状态栏的颜色


    你应该添加:

    <link rel="apple-touch-icon" href="apple-touch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">
    

    -iOs 启动器图标

    <meta name="msapplication-TileImage" content="icon.png">
    <meta name="msapplication-TileColor" content="#222222">
    

    - Windows 图标

    <link rel="apple-touch-startup-image" href="/startup-image.png">
    

    -iOs 启动图

    <meta name="mobile-web-app-capable" content="yes">
    

    - Android/Chrome 主屏幕


    你不需要:

    <meta name="keywords" content="Test"> 
    

    -不需要这个,google等搜索引擎不使用关键字meta

    <meta name="subject" content="Test">
    

    - 页面的主题。不推荐

    <meta name="copyright" content="Test">
    

    - 比其他人更适合你

     <meta name="url" content="http://www.test.com">
    

    -这是您的完整域名或网址。搜索引擎优化

    <meta name="language" content="en-GB">
    

    - W3C 建议使用&lt;html lang="en"&gt; 而不是元标记

    <meta name="pagename" content="$Title">
    

    - 这是附加的页面标题。 html5规范中没有这样的标签?

    <meta name="coverage" content="Worldwide">
    <meta name="distribution" content="Global">
    

    - 定义爬虫的分布级别或程度,但没有可识别的元数据,那么您不应该使用它们。对 HTML5 无效

     <meta name="target" content="all"> 
    

    - ???不知道它是什么:P 一些疯狂的 windows 旧东西? html5规范中没有这样的标签?

    <meta name="HandheldFriendly" content="True">
    

    - 旧的 Windows 手机未来会说该页面可以在小屏幕上查看

    <meta name="MobileOptimized" content="640">
    

    - 关于屏幕页面大小的声明已针对 Windows 进行了优化,但它适用于旧手机并且它并不能真正工作。我建议为此使用媒体查询。

     <meta name="format-detection" content="telephone=no">
    

    - iOS 上 Safari 的电话号码检测(如果禁用此功能,则用户体验不佳)

    <meta http-equiv="cleartype" content="on">
    

    - 移动 IE 平滑字体功能,但这不是标准的 W3C 标签。我建议在 CSS 中进行字体平滑处理。

    <meta name="apple-touch-fullscreen" content="yes">
    

    - 这是在早期的演示中使用的。你只需要&lt;meta name="apple-mobile-web-app-capable" content="yes"&gt;

    <meta name="ResourceLoaderDynamicStyles" content="">
    

    - 这应该让浏览器在添加 CSS 之前标记 DOM。我认为你不应该那样做。

    <meta http-equiv="Expires" content="0">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    

    - 缓存东西。现在,这类事情都是在服务器端完成的。

    <meta http-equiv="imagetoolbar" content="no">
    

    - IE6 功能。显然不需要

    <meta http-equiv="x-dns-prefetch-control" content="off">
    

    - DNS 预取。

    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> 
    

    - IE8/9 兼容模式。

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    

    - 重复条目&lt;meta charset="UTF-8"&gt;

       <!-- Makes your prototype chrome-less once bookmarked to your phone's home screen -->
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
    
        <!-- Set a shorter title for iOS6 devices when saved to home screen -->
        <meta name="apple-mobile-web-app-title" content="Ratchet">
    

    - 重复条目

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多