简体   繁体   中英

How can I allow orientation rotation while using manifest.json?

When I use a manifest.json file within my web application and "add to home screen" on Chrome for Android, it loads in fullscreen mode (great) but also gets locked in portrait orientation (not great).

I want to load in fullscreen, but still allow for orientation rotation. Is this possible?

{
  "name": "MyApp",
  "icons": [
    {
      "src": "launcher-icon-0-75x.png",
      "sizes": "36x36",
      "type": "image/png",
      "density": 0.75
    }
  ],
  "start_url": "/home",
  "display": "standalone",
  "orientation": "natural" // I have tried natural, any, leaving this property out altogether without success
}

According to boyofgreen, you should be able to supply one of many orientation options .

It turns out Chrome for Android was aggressively caching my manifest.json file. By manually clearing the cache "from the beginning of time" and setting the orientation property to a value of any I was able to get the desired behavior.

Worth noting, an orientation value of natural did not allow the screen to rotate.

I had the same problem with my app (linkthethings.com). I had used the android add to home screen. As well as removing the manifest.json orientation value I also had to uninstall the app and install it again. Even using clear cache option described in Clear Workbox cache of all content had no results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM