Ind.ie is now Small Technology Foundation.
Commit f546855c authored by Aral Balkan's avatar Aral Balkan

External web links (http, https) now open in the system browser. Fixes #107

parent 40d61bc3
......@@ -584,15 +584,20 @@ class TimelineViewController: NSViewController, WKNavigationDelegate
func webView(webView: WKWebView, decidePolicyForNavigationAction navigationAction: WKNavigationAction, decisionHandler: (WKNavigationActionPolicy) -> Void)
{
let url = navigationAction.request.URL
println("Web view asked to navigate to URL: \(url)")
if let url = url, theProtocol = url.scheme, theCommand = url.host
{
let theArguments = url.pathComponents
println(theArguments)
if theProtocol == "indie"
if (theProtocol == "http" || theProtocol == "https") && theCommand != "127.0.0.1" && theCommand != "localhost" && theCommand != "192.168.59.103" && !theCommand.hasPrefix("waystone.")
{
// Open web links in the system browser.
NSWorkspace.sharedWorkspace().openURL(url)
decisionHandler(WKNavigationActionPolicy.Cancel)
}
else if theProtocol == "indie"
{
switch theCommand
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment