I have implemented WKWebView everything works perfect. canGoBack value changed but canGoForward always return false. If I enable force fully then it works but When Any forward url there then I want to enable forward button.
WKWebView doesn't contain webViewDidStartLoad and webViewDidFinishLoad delegate method so I use didFinish method. It work for back button but forward button not working! I already checked StackOverFlow not find solution for WKWebview.
Below is my code:
func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void){
buttonConfiguration(webView: webView)
}
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
buttonConfiguration(webView: webView)
}
func buttonConfiguration(webView: WKWebView){
print("Back", webView.canGoBack)
print("Forward", webView.canGoForward)
backButton.isEnabled = webView.canGoBack
forwardButton.isEnabled = webView.canGoForward
}
Only mention code is related to this question Thank You!