Orientation property of manifest.json is not working

Viewed 4216

This is my 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"
    }
  ]
}

This web app should always be in landscape mode, but it opens in portrait mode.

There is a question present here with the same problem, but none of the answers are solving my problem

1 Answers

I just tried "orientation": "landscape" on a sample app, and it seems to work correctly. You can see the code for the sample here

Based on your description, there are two possibilities why this may have failed at the time. First, it may have been a bug in Chrome that prevented this from happening. And second, the escaping of the forward slashes in your icons properties of your manifest may have caused issues parsing the manifest.

For example, you icons property should be:

"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"
  }
]
Related