我正在尝试使用以下manifest 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"
}
使用chrome开发人员工具,我可以检查清单是否正确加载,一切看起来都很好:方向设置为portrait
(和显示为fullscreen
)。
但是将web应用程序添加到移动Chrome的主屏幕上,然后从那里打开它,我仍然可以横向查看web应用程序。
在这方面的任何帮助是感激的。谢谢。
刚刚发现orientation
属性只有在display
设置为standalone
时才有效:
{
…
"display": "standalone",
"orientation": "portrait",
…
}