     }
     
     fileprivate func launchExternalApp(url: URL) {
-        urlToLaunchWithPermission = url
-        if !externalAppPermissionAlertView.isVisible {
-            externalAppPermissionAlertView.show()
-        }
+        let alertController = UIAlertController(title: "Leave current app?", message: "This web page is trying to open an outside app. Are you sure you want to open it?", preferredStyle: .alert)
+        let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
+        alertController.addAction(cancelAction)
+        let openAction = UIAlertAction(title: "Open App", style: .default) { (action) in
+            if #available(iOS 10.0, *) {
+                UIApplication.shared.open(url)
+            } else {
+                UIApplication.shared.openURL(url)
+            }
+        }
+        alertController.addAction(openAction)
+        UIApplication.shared.keyWindow?.rootViewController?.present(alertController, animated: true)
     }
 }
 

    }
}

// MARK: - UIAlertViewDelegate
extension DLWebView: UIAlertViewDelegate {
    
    public func alertView(_ alertView: UIAlertView, didDismissWithButtonIndex buttonIndex: Int) {
        if alertView == externalAppPermissionAlertView {
            if buttonIndex != alertView.cancelButtonIndex {
                UIApplication.shared.openURL(urlToLaunchWithPermission!)
            }
            urlToLaunchWithPermission = nil
        }
    }
}

// FIXME: HTTPS request with self-signed certificate
// MARK: - NSURLConnectionDataDelegate
extension DLWebView: NSURLConnectionDataDelegate {

    private var _sharedCookiesInjection = false
    
    private let validSchemes = Set<String>(["http", "https", "tel", "file"])
    
    public convenience init(sharedCookiesInjection: Bool = false) {
        let webViewConfig = WKWebViewConfiguration()
