Search code examples
androidiosweb-applicationsmobilemobile-website

Defining URL for "put on homescreen" functionality


I'm working on a mobile webapplication which consists of multiple pages (with different urls)

/index.html
/products/1.html
/products/2.html
{...}

Now if the user is on one on the subpages and selects "put on homescreen", I'd like to put the startpage (i.e. /index.html) on the homescreen, so he goes to the home page when clicking on the icon instead of some subpage.

Is there any way to tell the mobile OS (iOS and Android in my case) which URL to choose for putting on the homescreen?


Solution

  • Unfortunately iOS chooses the current URL and does not provide a meta tag option to set this. As for Android I don't know whether there is a possibility to do this but I don't believe there is one. It makes sense for security reasons.

    But maybe there is a workaround for this. I thought about the following (untested, just brainstorming):

    • Create a session for the user and measure last interaction time. If the last interaction happened e.g. 10 minutes ago, redirect the user to the starting page. So if your user doesn't use the App for a while and calls it via the homescreen, he will be redirected to the first page.

    • Another method would be to use anchors for all the navigation and a script that disallows to directly browse to anchors without previous user interaction. So even if your user is at /index.html#products/2 he has to start at index.html