iOS UIWebView 返回或前进总是自动重新加载 webView,如何停止 webview 重新加载?



iOS UIWebView goback or goforward 总是自动重新加载 webView,如何停止 webview 重新加载?因为有些网址像"https://www.sina.cn/",如果网页视图请求网址,你会注意到网页视图无法前进。我该如何处理这种情况?

你可以在 https://github.com/misscxuan/WebBackTest 看到我的代码

如果 webview 请求 url 作为"https://www.sina.cn/",并请求另一个 URL,那么 webview goback,你会发现 webview 无法前进。

您可以在UIWebviewDelegate方法- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType中停止加载任务。

最新更新