ollm commented on PR #1333:
URL: https://github.com/apache/cordova-ios/pull/1333#issuecomment-1570402298
As an example this is the code that I am currently testing in the plugin.
``` swift
@objc func shouldOverrideLoadWithRequest(_ request: URLRequest,
navigationAction: WKNavigationAction) -> Bool {
var allowNavigationsPass = true
if let url = request.url, url.scheme == "http" || url.scheme == "https" {
if navigationAction.sourceFrame == nil {
allowNavigationsPass = false
}
switch navigationAction.navigationType {
case .linkActivated: // This is not triggered in some iframes
allowNavigationsPass = false
case .other:
if urlString = url.absoluteString {
let range = urlString.range(of: "utm_content")
if range != nil {
allowNavigationsPass = false
}
}
default:
break
}
if !allowNavigationsPass {
UIApplication.shared.open(url)
}
}
return allowNavigationsPass
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]