在渐进式web应用程序的web应用程序清单中,是否可以根据用户正在查看的页面设置不同的方向?
下面是我的manifest.json的样子:
{
"dir": "ltr",
"lang": "en-US",
"name": "My Application",
"scope": "/",
"display": "standalone",
"start_url": "start_page.aspx",
"short_name": "My App",
"theme_color": "transparent",
"description": "My App Description",
"orientation": "portrait",
"background_color": "#00A3CC",
"related_applications": [],
"prefer_related_applications": false,
"icons": [
{
"src": "Images/Icon.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "Images/Icon.png",
"type": "image/png",
"sizes": "512x512"
}
]
}上面的清单导致在安装应用程序时https://example.com/start_page.aspx和其他所有页面都以纵向显示。是否可以强制https://example.com/other_page.aspx以横向显示,同时保持站点的其余部分以纵向显示?
发布于 2018-07-03 02:40:02
manifest.json - orientation是整个应用程序的静态选项。你不能有每页/每模块的值。
您有两个选项来解决您的问题。
1)使用CSS进行定向-在当前页面(如SPA)中加载a中的other_page.aspx,并使用CSS as in this answer通过移动90度在横向中进行定向。
2)让你的other_page.aspx成为一个单独的应用程序,带有一个单独的横向manifest.json。只有当这样做有意义时,你才能这样做,因为它是一个逻辑上不同的模块。
https://stackoverflow.com/questions/51090383
复制相似问题