WKWebViewConfiguration:
[configuration setURLSchemeHandler:self forURLScheme:@"wkpath"];
WKWebView:
NSString *html = @"\
<html><body> \
<script src=\"wkpath://script\"/> \
<img src=\"wkpath://image\"/> \
</body></html>";
[webView loadHTMLString:html baseURL:baseURL];
委托
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask {
// <script> url task never enter
// <img> url task have enter
}
猜测WebKit内部原因。