braintree / popup-bridge-ios

Enable your web view to open pages in an ASWebAuthenticationSession
MIT License
38 stars 20 forks source link

Add isIosWebview property to popupBridge #18

Closed skunkworks closed 5 years ago

skunkworks commented 5 years ago

By having the iOS PopupBridge library set up the popupBridge JS object with this property, it makes it trivial for the web app's JS to detect when the web page has been loaded in an iOS webview.

crookedneighbor commented 5 years ago

@skunkworks can you provide the use case for this?

skunkworks commented 5 years ago

@crookedneighbor For Venmo webview integrations, they need to set up the deepLinkReturnUrl property based on whether their checkout page is being loaded in an iOS webview or an Android webview (or not in a webview at all). This is fairly onerous for merchants, who might be able to accomplish this by setting a custom user agent string for their webviews, or otherwise use user agent strings. It seems sensible to instead have PopupBridge clearly identify which platform the web app is being loaded from.

crookedneighbor commented 5 years ago

@skunkworks they can't inject their own JS into the webview and use that to determine it? I feel like merchants should not be checking for the popupBridge object on the window in their own integrations.

skunkworks commented 5 years ago

I think that's fair. Closing

crookedneighbor commented 5 years ago

In fact, if they did check for the popupBridge object themselves, that would also tell them that they are in a webview. No need for extra properties.