iOS WebView: Open link in external browser (Safari) | How To ⚙️

WebViews are a common framework for iOS app developers. They allow developers to use a web browser to show web pages inside of their app. This is done using the WKWebView class, which loads content from a URL specified in the constructor.
In order for iOS WKWebViews to handle (external) links like Social Media correctly, we need to specify the correct type for our links and provide an intelligent mechanism.
In WebViewGold for iOS, you can change these configuration variables:

openallexternalurlsinsafaribydefault: Set to true to open all external hosts in Safari.

safariwhitelist: Add domains here that should always be opened in Safari, regardless of what the openallexternalurlsinsafaribydefault option is set to; to add another domain, insert another host like so: [“alwaysopeninsafari.com”, “google.com”, “m.facebook.com”]; make sure to enter the domains exactly how you link to it (with or without www, for example).

safariblacklist: Add domains here that should never be opened in Safari, regardless of what the openallexternalurlsinsafaribydefault option is set to; to add another domain, insert another host like so: [“alwaysopeninsafari.com”, “google.com”, “m.facebook.com”]; make sure to enter the domains exactly how you link to it (with or without www, for example).

You can download the WebViewGold app template for iOS here.