PWA install on iOS only create a shortcut

AI-generated summary

A user th21 reports that installing their Discourse-based PWA on iOS iPhones (iOS 14.4.2 and 15.0.2) only creates a Safari shortcut instead of launching the PWA in standalone mode — despite working correctly on Android and iPadOS. The site runs on Discourse 2.8.0.beta11. After investigation, Falco requests the value of SiteSetting.pwa_display_browser_regex, which returns a^ — indicating no browser is excluded from PWA display. Falco confirms the issue doesn’t occur on their iPad, and th21 narrows it down to iPhones only. Since Falco lacks an iPhone, they can’t debug further. Ultimately, th21 discovers the root cause: inserting an element inside the </head> tag in their theme breaks PWA behavior on iPhones. This highlights a subtle but critical theme customization issue affecting iOS PWA rendering.

Hi, I was successfully installed PWA on my iPhone around a year ago, but today as I delete it and try to add it back as PWA (add to home screen from safari), it doesn’t work. It does create a new icon on the home screen, but clicking on the icon only leads to opening the website in safari instead of rendering it just in place.

I don’t have an android device but upon my user’s feedback, it seems still to work on android.

My site is running 2.8.0.beta11(4bf6789bd7)

I also check on meta to see if the same issue happened, it didn’t. As I look through related topics, PWA shouldn’t require extra settings. Having no idea how to debug this…

meta theme-creator my site
iOS 14 (iOS 14.4.2) √ √ X
iOS 15 (iOS 15.0.2) √ √ X
android √
iPad (iPad OS 14.7.1) √

Thank you so much for reporting this! We have assigned this out and will work on this shortly :slight_smile:

Can you paste the output of the following here as a reply?

docker exec -i app rails runner "puts SiteSetting.pwa_display_browser_regex"

where should I run this command? after ./launcher enter app ?

On the server where Discourse is running. There is no need to run any command before.

the result is a^ after this command

Can you share the URL of the instance so I can check on my devices?

I can’t reproduce this on my iPad. I can add the site to the homescreen and tapping on it open the website on it’s own “window” instead of opening a new tab on Safari.

I can’t reproduce this on my iPad either, seems only happened on iPhone(reproduced on mine and others’ iPhone), I updated the checklist in OP to include detailed OS info.

Oh I don’t own an iPhone so I’m unable to help here any further.

Found it was because I insert an element in </head> tag.