Skip to content

Instantly share code, notes, and snippets.

@dakeshi
Last active July 7, 2016 09:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dakeshi/56980c7d883dad1c4c77 to your computer and use it in GitHub Desktop.
Save dakeshi/56980c7d883dad1c4c77 to your computer and use it in GitHub Desktop.
open Safari app in response to JS window open, target = _blank tag
// 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