Last active
July 7, 2016 09:17
-
-
Save dakeshi/56980c7d883dad1c4c77 to your computer and use it in GitHub Desktop.
open Safari app in response to JS window open, target = _blank tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// confirm : WKUIDelgate protocol | |
// To dealt with JS window open or target = _blank tag | |
// - result : open Safari app | |
func webView(webView: WKWebView, createWebViewWithConfiguration configuration: WKWebViewConfiguration, forNavigationAction navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { | |
if UIApplication.sharedApplication().canOpenURL(navigationAction.request.URL!) { | |
UIApplication.sharedApplication().openURL(navigationAction.request.URL!) | |
} | |
return nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment