Is it possible to use relative paths for scope, start_url and id in webmanifest.json?

590 Views Asked by At

Let's say we have a web application which is available through different environments:

nightly.my-app.com
test.my-app.com
my-app.com

Using webmanifest.json we want to identify each version of our app, but we don't want to create a different webmanifest for each build. So we used these values:

"scope": "./",
"start_url": "./",
"id": "./",

My questions are:

Are these values valid? Will the browser/ device automatically resolve all values to the actual URL of the app?

1

There are 1 best solutions below

2
Mahdi Zarei On

When you define scope all the paths will be relative to that.

referring to developer.mozilla.org:

The scope member is a string that defines the navigation scope of this web application's application context. It restricts what web pages can be viewed while the manifest is applied. If the user navigates outside the scope, it reverts to a normal web page inside a browser tab or window.

It also says:

If the scope is a relative URL, the base URL will be the URL of the manifest.

So don't worry. this is legit and will work fine.