Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
317 views
in Technique[技术] by (71.8m points)

javascript - The values of meta viewport attribute are not reflected when in full screen mode in android chrome browser

When I am in full screen mode in android using fullscreen api, the values of meta viewport attribute like initial-scale and user-scalable are not reflected in the browser. If I am not in full screen mode, the values of meta viewport are reflected. You can check it by accessing MDN:Fullscreen api example from a mobile browser

I don’t find any source saying meta viewport will be disabled in fullscreen in android. So am I making any mistake or no one has documented it? Also pinch and zoom is disabled when in fullscreen

Raised a issue in https://github.com/whatwg/fullscreen/issues/111 but no luck.

Want to know if there are alternatives to solve it

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I was able to go fullscreen by an alternative method using the web app manifest. It does not interfere with the meta viewport.

Here are the steps

  1. Add this to the head section:
<link rel="manifest" href="/manifest.json">
  1. Create a manifest file like the following:
 {
      "short_name": "App Name",
      "name": "Full app name",
      "icons": [
        {
          "src": "launcher-icon-4x.png",
          "sizes": "192x192",
          "type": "image/png"
        }
      ],
      "start_url": "/index.html",
      "display": "fullscreen",
      "orientation": "landscape"
  }

The Google developers documentation to launch in fullscreen using a manifest is available here.

The issue of fullscreen disabling the metaview port is raised here.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...