Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open external links in browser/safari #26

Open
burnzzzzz opened this issue Jun 13, 2017 · 1 comment
Open

Open external links in browser/safari #26

burnzzzzz opened this issue Jun 13, 2017 · 1 comment

Comments

@burnzzzzz
Copy link

Hi

Great work on this project and I love using it however I have made my app all local with no external links , i.e all "local". But I have now added some external resource links (wikipedia etc) and wish to make the external links open in safari instead of the app. I have worked out how to do this in Java/Android by checking if the URL contains the added pram "external_link" but I don't know how to do this for iOS.

This is not much of an issue, more of a feature request.

Thanks

@7685
Copy link

7685 commented Apr 20, 2018

Just add the below snippet in the ViewController file which is subscribing to WKNavigationDelegate, WKUIDelegate. Then it will open _blank URLs in safari and others inside the app.

func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
        if navigationAction.targetFrame == nil {
            //webView.load(navigationAction.request)
            UIApplication.shared.open(navigationAction.request.url!, options: [:])
        }
        return nil
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants