JRS
JRS

Reputation: 741

iphone "add to home screen" ignores querystring parameters

I have a mobile-friendly web application which I want users to be able to access from a link sent in an email or text. The link will include a querystring parameter specific to that user, which controls what the web site displays. This link might look like this:

https://corpsite/myapplication/?show=578

When the user goes to this URL using safari, the site grabs some information which is correct for the "show=578" parameter and all is good. (Security is not a factor here.) But after the application is installed to the home screen with the "Add to Home Screen" function of the iPhone 8 I am testing with, the URL which opens upon clicking the home screen icon is:

https://corpsite/myapplication/

The querystring information is not preserved! (I ultimately wrote some debugging code that tells me the full URL when the application loads. When I click on the link from an email and go there in Safari, the reported URL includes the querystring. But when I then save that page to the home screen and later click on the home screen icon, the reported URL does not include any querystring information.)

I have added this to the index.html page of the (Angular 5) application, which I thought would be all I would need to do (aside from some icon-related tags):

<meta name="apple-mobile-web-app-capable" content="yes">

How can I make this work from the home screen icon?

Upvotes: 4

Views: 3421

Answers (1)

JRS
JRS

Reputation: 741

I found the source of my problem here: PWA loses its params and query params after being added to the home screen.

It turns out that I was setting the start_url in my manifest.json file, and that was overriding the value in the browser. I just removed that setting from the manifest.json file, and the phone then used the URL from the browser when saving to the home screen.

Upvotes: 9

Related Questions