7

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

Yash Kochar
  • 461
  • 6
  • 15

1 Answers1

0

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"
  }
]
PeteLe
  • 1,755
  • 10
  • 19
  • I noticed that app, when you go to the menu in Chrome Mobile, gives you the option to install it... my app only gives you the option to "Add to Home screen". Should that make any difference? My manifest doesn't have icon, color, shortcut or share target tags, but i don't see why i should need them just for landscape mode to work – Michael Mar 06 '21 at 23:59
  • Ok this is weird. I updated from Chrome 87 to 89 and re-added to the home page and now it shows landscape but i still can't get rid of the huge title bar at the top, even though i'm using display:standalone – Michael Mar 07 '21 at 00:02