'Open link in safari instead of the native app

I am trying to open a link when a user clicks a button, using window.open() on button click. Currently this works as expected in Android browsers, but on IOS it opens up the native app for that link, for example, if I have the youtube app installed and i try window.open(url, '_system') from javascript, it will open the youtube app. Is there a way to force it to open the url in safari and not open the app.



Solution 1:[1]

There is no way to force it to open the url in safari and not open the app. Every app will have list of urls that it can open. So you have to go to that app settings and tell that it should open in browser for the urls and not in the app.

Solution 2:[2]

In case you're using javascript with the ionic framework you can use ionic InAppBrowser

import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'

constructor(private _iab: InAppBrowser){}

openBrowser(url: string) {
  this._iab.create(url, '_system')
}

If not, then where are you developing your app

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Thanh Tùng Nguy?n
Solution 2 Raphaël Balet