Reputation: 81
I am working on Node.js and PWA. The starting url of my project contains params e.g localhost:3000/:name, where name is a variable which user gives while running the app. Now the problem is, setting start_url in manifest. How to set the start_url in manifest.json file?
Thanks for looking!
Upvotes: 2
Views: 2522
Reputation: 207
I had a somewhat similar issue (start_url dependent upon a link that was clicked to get to the page in the first place...).
If you use a dynamic json manifest, you can set custom start_urls.
How to create PWA manifest.json dynamic?
NOTE: so far, I've not been able to get Chrome Developer Tools Lighthouse to think that a dynamic manifest is an installable app, but I've not had any problems actually installing it yet.
Upvotes: 0
Reputation: 10100
You can't make the start URL dynamic. Use the JS code in the home page loaded by start URL to post that data to server side and have the actual content which you intent to load based on the param you pass.
If you want to write some code specific for PWA launched from home screen(where this start URL comes into picture) you can use this mode detect option to write such custom code in case of Home screen PWA launch.
Upvotes: 2