【问题标题】:Progressive web application - not honouring screen orientation渐进式 Web 应用程序 - 不尊重屏幕方向
【发布时间】:2017-04-19 11:25:08
【问题描述】:

我的网络应用程序不遵守我在manifest.json 中设置的方向:

{
  "manifest_version": 2,
  "version": "1",
  "name": "My App",
  "short_name": "My App",
  "icons": [
    {
      "src": "img/myapp/launcher-icon-0-75x.png",
      "sizes": "36x36",
      "type": "image/png"
    },
    {
      "src": "img/myapp/launcher-icon-1x.png",
      "sizes": "48x48",
      "type": "image/png"
    },
    {
      "src": "img/myapp/launcher-icon-1-5x.png",
      "sizes": "72x72",
      "type": "image/png"
    },
    {
      "src": "img/myapp/launcher-icon-2x.png",
      "sizes": "96x96",
      "type": "image/png"
    },
    {
      "src": "img/myapp/launcher-icon-3x.png",
      "sizes": "144x144",
      "type": "image/png"
    },
    {
      "src": "img/myapp/launcher-icon-4x.png",
      "sizes": "192x192",
      "type": "image/png"
    }
  ],
  "theme_color": "#43c1b1",
  "background_color": "#43c1b1",
  "start_url": "/myapp",
  "scope": "/myapp",
  "orientation": "landscape",
  "display": "standalone"

}

其他一切都有效 - 图标和背景颜色,那么为什么强制横向会出现问题?

Chrome(在移动设备上)v 57.0.2987

谢谢

【问题讨论】:

    标签: javascript google-chrome manifest progressive-web-apps


    【解决方案1】:

    您的原始 manifest.json 是正确的,但它仅适用于 Chrome Canary(版本 59),但不适用于 Chrome 稳定版(版本 57)。

    但我在发布日志中找不到任何提及。

    【讨论】:

    • 谷歌最近公布了what was new in Chrome 58,预计六周内将有 59 个细节。
    • 不适用于 2020 年的 Chrome for Android 版本 83
    【解决方案2】:

    我认为你做得对。基于此page,您可以强制执行特定方向,这对于使用此"orientation": "landscape" 仅在一个方向上工作的应用程序是有利的。

    尝试像example一样将显示器放在方向之前。

    {
      "short_name": "Kinlan's Amaze App",
      "name": "Kinlan's Amazing Application ++",
      "icons": [
        {
          "src": "launcher-icon-2x.png",
          "sizes": "96x96",
          "type": "image/png"
        },
        {
          "src": "launcher-icon-3x.png",
          "sizes": "144x144",
          "type": "image/png"
        },
        {
          "src": "launcher-icon-4x.png",
          "sizes": "192x192",
          "type": "image/png"
        }
      ],
      "start_url": "/index.html",
      "display": "standalone",
      "orientation": "landscape"
    }
    

    【讨论】:

    • 似乎更改显示顺序和方向也不起作用。 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-23
    • 2015-12-11
    • 2017-05-06
    • 2023-03-07
    相关资源
    最近更新 更多