I have a webview which is connected to a url, on this url there is a link that when clicked, should open waze with an adress. on safari it works fine but when I try to open it through my webview it doesn't seem to work. is there any way to do that?
To open the link externally, you'll need to set the UIWebViewDelegate
for the webview.
Then, implement:
func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool
From there, you can grab the URL
out of the URLRequest
and open the link externally.
Then, you can call func open(_ url: URL, options: [String : Any] = [:], completionHandler completion: ((Bool) -> Void)? = nil)
on your UIApplication
with the URL
from the webview.