I have a manifest.json
and it has a start_url
property that I want to point to the first file of my single page application.
This is index.html
, and it's the root of the site. I want this to be the start_url
, but that file is never asked for as a URL.
How do I point start_url
at the relative root of the site?
For instance, suppose the site is at https://example.com
, what should the value of start_url
be in https://example.com/manifest.json
? I want the PWA to start at https://example.com
and not https://example.com/index.html
. The PWA might be put on a different domain, so start_url
needs to be relative, not absolute.
The start_url member is a string that represents the start URL of the web application — the preferred URL that should be loaded when the user launches the web application (e.g., when the user taps on the web application's icon from a device's application menu or homescreen).
First check if manifest. json is applied in the browser. For that open developer window by pressing shortcut F12. In Application tab, click Manifest option and see if it displays information that you have set.
If you are running in the root of a site, for instance https://example.com/manifest.json
or https://test.example.com/manifest.json
you can use "start_url": "/"
.
However, this will also map https://example.com/test/manifest.json
to https://example.com/
, which fails because it's in a folder outside the scope of the manifest.
Instead, if you are using a sub-directory you need to set both a scope
and the start_url
:
"start_url": "./" "scope": "."
This will cause https://example.com/test/manifest.json
to map to https://example.com/test/
as expected.
Your start_url should be set to the following in your manifest file.
"start_url": "/"
Source: https://developers.google.com/web/fundamentals/integration/webapks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With