Web 应用清单:默认方向的设置被忽略

Kar*_*ten 5 android web-applications screen-orientation

我正在尝试使用以下清单 JSON 文件设置 Web 应用程序的默认方向:

{
  "manifest_version": 2,
  "version": "0.9",
  "short_name": "My Web App",
  "name": "My Web App in Portrait Mode",
  "icons": [
    {
      "src": "/homescreen-icon.png",
      "sizes": "196x196",
      "type": "image/png"
    }
  ],
  "start_url": "/index.php",
  "display": "fullscreen",
  "orientation": "portrait",
  "theme_color": "#5a8238",
  "background_color": "#1a2a08"
}
Run Code Online (Sandbox Code Playgroud)

使用 Chromes 开发人员工具,我可以检查清单是否已正确加载并且一切正常:方向设置为portrait(并且显示为fullscreen)。

但是将 Web 应用程序添加到移动 Chrome 上的主屏幕,然后从那里打开它,我仍然可以横向查看 Web 应用程序。

对此的任何帮助表示赞赏。谢谢。

Kar*_*ten 3

刚刚发现该orientation属性仅在display设置为时才有效standalone

\n\n
{\n  \xe2\x80\xa6\n  "display": "standalone",\n  "orientation": "portrait",\n  \xe2\x80\xa6\n}\n
Run Code Online (Sandbox Code Playgroud)\n