首页 > 解决方案 > Hide address bar in Progressive Web Applications

问题描述

I'm developing a PWA with VueJS. I started testing my application in real devices (Add to home screen). My application is intended to be 100% height, as it displays a map as you can see:

enter image description here

It seems that sometimes, transitions that appear from outside the viewport height, makes the address bar appear at the top of the page. For a PWA, I think this behaviour makes the app feel less native, and also, breaks my design (The button at bottom center and the whole map container are not visible unless the user close manually the address bar).

enter image description here

I tried some things I've seen in other questions:

I don't care if the app does not hide the address bar when visited in a web browser. But at least I want the address bar hidden when the app is launched as a "native" app (added to home screen).

I also tried changing display property in the manifest.json from standalone to fullscreen with no luck.

I know I could change the css for my button and map in order to make them "visible" when the address bar is visible, but as I said, this makes feel the app less native IMO.

Is there a solution for hidding permanently the address bar? Is it possible or it is something I have to consider in my design?

标签: fullscreenprogressive-web-appsmanifest.json

解决方案


当您尝试在scope. 例如,如果您在 manifest.json 文件中设置了范围,scope: "/my-pwa/"那么所有页面 url 都应该有这样的前缀:/my-pwa/page.html.


推荐阅读