0

First of all... My other question got marked as a duplicate even though the question suggested was the exact opposite, so:

Inside my webView I do not want to be redirected to other apps. WKWebView should never redirect to other Apps. Instead it should just open the url.

This is my webView:

lazy var webView: WKWebView = {
    let webConfiguration = WKWebViewConfiguration()
    let webView = WKWebView(frame: .zero, configuration: webConfiguration)
    webView.uiDelegate = self
    webView.translatesAutoresizingMaskIntoConstraints = false
    return webView
}()
Chris
  • 1,828
  • 6
  • 40
  • 108
  • Does this answer your question? [Disable WKWebView for opening links to redirect to apps installed on my iPhone](https://stackoverflow.com/questions/37086605/disable-wkwebview-for-opening-links-to-redirect-to-apps-installed-on-my-iphone) – Witek Bobrowski Jan 19 '21 at 23:08
  • @WitekBobrowski no... as mentioned in the comments of this question the suggested answer is not working on the latest iOS versions – Chris Jan 19 '21 at 23:11
  • What do you mean by other apps? Other hosts outside of the one you provide to WKWebView? – Luca Sfragara Jan 19 '21 at 23:48
  • @LucaSfragara I don't my `webView` to redirect to other apps I have on my phone. For example: If I serach for "Zalando" in my `webView` and tap on the first link, I get redirected to my Zalando App. I do not want that! It should simply open the URL inside my `webView` – Chris Jan 19 '21 at 23:50
  • Sounds like you're talking about wanting to prevent universal links from opening other apps from your web view. I don't think it's possible unless you use private API, as shown in some of the answers [here](https://stackoverflow.com/questions/38450586/prevent-universal-links-from-opening-in-wkwebview-uiwebview). – TylerP Jan 20 '21 at 00:50
  • @Tyler I dont see a working function for Swift 5 there or am I wrong ? – Chris Jan 20 '21 at 00:52

0 Answers0