iOS WKWebView 's didCommitNavigation never called?

424 views Asked by At

In my test code , I open the http://www.qq.com/ with a WKWebView . And I found that ,there will be 3 delegate methods to be called:

webView:(WKWebView *)webView decidePolicyForNavigationAction:
webView:(WKWebView *)webView didStartProvisionalNavigation:
webView:(WKWebView *)webView didFinishNavigation:

And these two method will never be called

webView:(WKWebView *)webView decidePolicyForNavigationResponse:
webView:(WKWebView *)webView didCommitNavigation:

And I want to know what make the method to be called or not ?

1

There are 1 answers

0
ximmyxiao On BEST ANSWER

OK, I found the reason here: it's because my webview is using the WebViewJavaScriptBridge , and this bridge cause the two method will not be called . so if u need these two method to working ,do it as follows https://blog.csdn.net/zyx980193917/article/details/107064789