这是我的manifest.json
{
"name": "XXXXX",
"short_name": "XXXXX",
"start_url": "/",
"gcm_sender_id": "XXX",
"background_color": "#dfdfdf",
"display": "standalone",
"orientation": "landscape",
"icons": [
{
"src": "\/icons\/android-chrome-128x128.png",
"sizes": "128x128",
"type": "image\/png"
},
{
"src": "\/icons\/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image\/png"
},
{
"src": "\/icons\/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image\/png"
},
{
"src": "\/icons\/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image\/png"
}
]
}

此网络应用应始终处于横向模式,但会以纵向模式打开。
这里有一个question出现同样的问题,但没有一个答案能解决我的问题
答案 0 :(得分:0)
我刚刚在 sample app 上尝试了 "orientation": "landscape"
,它似乎工作正常。您可以看到示例 here
根据您的描述,当时这可能失败的原因有两种。首先,可能是 Chrome 中的一个错误阻止了这种情况的发生。其次,在清单的 icons
属性中转义正斜杠可能会导致解析清单时出现问题。
例如,你的图标属性应该是:
"orientation": "landscape",
"icons": [
{
"src": "/icons/android-chrome-128x128.png",
"sizes": "128x128",
"type": "image/png"
},
{
"src": "/icons/android-chrome-144x144.png",
"sizes": "144x144",
"type": "image/png"
},
{
"src": "/icons/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/icons/android-chrome-256x256.png",
"sizes": "256x256",
"type": "image/png"
}
]