Websites are unable to detect Safari View Controller

Originator:elliot.lee
Number:rdar://31117000 Date Originated:17-Mar-2017 10:49 AM
Status:Duplicate of 24403385 (Open) Resolved:
Product:iOS + SDK Product Version:
Classification: Reproducible:Always
 
Online services such as PayPal and Facebook Login require the use of a popup for secure user authentication while also keeping the user in the context of the merchant's website. Safari View Controllers prevent this popup from working at all. That's okay if the website can detect the SFSafariViewController using JavaScript, but it cannot. Unfortunately, the Safari View Controller presents itself to the website and its scripts as a regular Safari browser, with popup support.

Although it does open the new window with a URL bar, it loses the context of the original page and cannot communicate back with it. We normally do this using the PostMessage JS API.

We need a way to consistently detect that our page is inside a Safari View Controller, so that we can work around the issue (for example, with an error or a fall-back iframe lightbox flow).

In other words, there needs to be a way to detect SFVC vs. Safari. This is because some apps, e.g. Slack, open every web link in SFVC, so our web page needs to be able to handle it.

Steps to Reproduce:
1. Open a website in an SFSafariViewController
2. Have the website attempt to open a popup
3. Have the popup communicate back to the website

Alternatively:
1. Open a website in an SFSafariViewController
2. Allow the website to somehow detect that it is in a Safari View Controller (or some other browser that doesn't have full popup support)

Expected Results:
The popup successfully communicates back to the website.

Alternatively:
The website consistently detects that it's in a Safari View Controller.

Actual Results:
The popup cannot communicate back to the website, which no longer exists (the entire page is redirected).

Alternatively:
There's an API or user-agent string identifier that we can use to detect Safari View Controllers.

Version:
All versions with SFSafariViewController support

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!