To avoid reading the user agent string, check the standalone property of the navigator object. This is a non-standard property, and it's only available on the WebKit engine on iOS and iPadOS.
If navigator.standalone is undefined it means the user is not on an iPadOS or iOS device.
If navigator.standalone is false it means the user opened the PWA in the browser and is using it there.
If navigator.standalone is true it means the user opened the PWA from the home screen and is getting the standalone PWA experience.
To avoid reading the user agent string, check the standalone property of the navigator object. This is a non-standard property, and it's only available on the WebKit engine on iOS and iPadOS.
If navigator.standalone is undefined it means the user is not on an iPadOS or iOS device. If navigator.standalone is false it means the user opened the PWA in the browser and is using it there. If navigator.standalone is true it means the user opened the PWA from the home screen and is getting the standalone PWA experience.