渐进式Web应用程序 - 不尊重屏幕方向

时间:2017-04-19 11:25:08

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

我的网络应用不遵守我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

由于

2 个答案:

答案 0 :(得分:1)

我认为你做得对。根据此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"
}

答案 1 :(得分:1)

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

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