4

I am having a problem with web app manifest scope on my local Node JS test server. I cannot get the correct scope because the port number on the IP address gets in the way. I am accessing my server with the following address:

https://192.168.0.101:2468/

When I use Chrome dev tools to look at my manifest, under the Application tab it shows the url of the manifest file to be: :2468/manifest.json but :2468 is not a directory in my root folder.

I keep all my files in the root directory, including the server.js, the manifest.json, and the index, called my-app.html

_ website-directory
|_ server.js
|_ manifest.json
|_ my-app.html

In my manifest file I have:

{

  "scope": "./",
  "start_url": "my-app.html"

}

Everything works perfectly when I upload the code to my Github Pages site here: working example. I think the problem is coming from the :2468 behind my IP address. I do not have this problem with a fully qualified domain name like I have with Github Pages.

If I try to put the port number into the manifest's scope like so:

  "scope": "./:2468/",
  "start_url": "my-app.html"

It breaks the scope of my manifest and I get this warning: Manifest: property 'scope' ignored. Start url should be within scope of scope URL. Which makes perfect sense because :2468 is not a folder in my directory. It's just something Chrome decided to attach to the url of my manifest file.

How do I resolve the scope of my manifest file to ignore the port number? Why does Chrome dev tools indicate that my manifest is in the :2468 directory that does not exist?

The reason this is a problem is because my web app will not open in app mode, with a full screen window and splash screen. It only opens in a browser with a url bar and doesn't seem to be using the app manifest at all.

UPDATE: 11/05/17

By using the URL https://192.168.0.101:2468/my-app.html I can access my web app without dev tools showing :2468/ in my manifest url. My app does install to both the home screen and the app drawer, but it only opens in a browser rather than a full screen app with a splash screen. I get no warnings about the manifest scope, and my service worker registers and runs perfectly. I am beginning to think that progressive web apps cannot be installed from an IP address, but only fully qualified domain names. Could this be the problem?

Frank
  • 2,050
  • 6
  • 22
  • 40

1 Answers1

0

You're correct, Progressive Web Apps must be installed at a somewhat proper URL because they require that scope to operate properly. Without the scope being enforced, a rogue service worker could gain access to sites that it shouldn't.

Nathan Heffley
  • 610
  • 5
  • 12
  • Is it possible that the Android Intent Filter being generated from my IP address is not valid? This filter tells Android how to open my web page (in app mode or in a browser). As far as I can tell, I have no power to control what is in this intent filter, and Chrome generates it based on my page URL and my app manifest. – Frank Nov 05 '17 at 14:00
  • Have you specified the `display` property in your web app manifest? It sounds like you want it set to `display: standalone` – Nathan Heffley Nov 05 '17 at 15:53
  • I have tried setting it to standalone and fullscreen. It is not a manifest problem, as everything works fine when I add to home screen from my Github site, it simply doesn't work when I add to home screen from my local ip address. – Frank Nov 08 '17 at 21:10