so when you make a webpage and you give it a custom scheme so you can get a msg back from the js to do things, like close for example. It goes through this function, only it never fires
#pragma mark - WKNavigationDelegate
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *url = [[[navigationAction request] URL] absoluteString];
if ([[webView.URL scheme] isEqualToString:self.jsScheme]) {
self.onJsCallback([url UTF8String]);
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
if (self.shouldStartLoading && url) {
if (self.shouldStartLoading([url UTF8String]) )
decisionHandler(WKNavigationActionPolicyAllow);
else
decisionHandler(WKNavigationActionPolicyCancel);
return;
}
decisionHandler(WKNavigationActionPolicyAllow);
}
NSString *url = [[[navigationAction request] URL] absoluteString];
if ([[webView.URL scheme] isEqualToString:self.jsScheme]) {
because it checks against the schema of the web page ( which won’t be what you want its going to be a file or http. Instead of the requested URL.
Or am I missing something?