使用WKWebView不能加载除了http及https开头的url,而UIWebView可以,所以需要自己调用,代码如下:
func webView(webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) { let urlStr = webView.URL?.absoluteString let lowUrlStr = urlStr!.lowercaseString if lowUrlStr.hasPrefix("sms") || lowUrlStr.hasPrefix("tel") || lowUrlStr.hasPrefix("mailto") { let app = UIApplication.sharedApplication() if app.canOpenURL(NSURL.init(string: lowUrlStr)!) { app.openURL(NSURL.init(string: lowUrlStr)!) } return } }
http://blog.csdn.net/sinat_31484193/article/details/51482941