androidioshomescreen

"Save to Home Screen" only saves the root path


I have a web app specifically designed for mobile use. The user gets a login URL containing a tenant ID in the query, e.g. https://m.example.com/login?tenant=123

If I try to add this to the home screen, the link saved is just the root path, https://m.example.com/, so the tenant ID is lost in the process. I observe the same behavior on both iPhone and Android.

Can I preserve the tenant ID when adding to home screen?

This question seems related, except the question describes the exact opposite behavior, indicating that the default behavior has changed since 2012.


Update:

Long after this (XY question) was asked, a much better solution was found to the actual problem: segregating by tenant in the link. Rather than an ID in a query; a slug was used in a subdomain. The server easily detects the tenant by subdomain, and the UI doesn't need to worry about it at all.


Solution

  • I was about to vote to close my own question, as it's almost a duplicate of this question. But SO requires the duplicate to be on SO.

    If there is a manifest.json file with a start_url field, that will suggest which URL to add to the home screen. Our application was bootstrapped with create-react-app, which creates a skeleton manifest with start_url: "/", which is why we observed that behavior. By removing that line from the manifest, it works as intended.

    This answer also demonstrates how the manifest can be generated dynamically on the front-end. That functionality could be relevant in this scenario, where you need to have the tenant id in the URL, but still maybe want to have a specific start page.