【问题标题】:Web App manifest: Setting of the default orientation is ignoredWeb 应用清单:默认方向的设置被忽略
【发布时间】:2017-02-19 09:46:47
【问题描述】:

我正在尝试使用以下清单 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"
}

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

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

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

【问题讨论】:

    标签: android web-applications screen-orientation


    【解决方案1】:

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

    {
      …
      "display": "standalone",
      "orientation": "portrait",
      …
    }
    

    【讨论】:

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