如何实现重定向页面的跳转
clq1983 opened this issue · 4 comments
clq1983 commented
我发现如果有302跳转,就会跳转不过去,页面卡死,我实现下面的方法也没有效果:
clq1983 commented
实现如下方法,还是没有效果,请问楼主这个问题有什么好的方法解决不?
-
(void)URLSession:(NSURLSession *)session
task:(NSURLSessionTask *)task
willPerformHTTPRedirection:(NSHTTPURLResponse *)response
newRequest:(NSURLRequest *)request
completionHandler:(void (^)(NSURLRequest *))completionHandler
{
NSURLRequest *redirectRequest = request;if (completionHandler) {
completionHandler(redirectRequest);
}
}
karosLi commented
如果取消webview复用会有问题吗?
clq1983 commented
去掉复用也会有
发自我的 iPhone
… 在 2021年5月11日,上午11:09,Karosli ***@***.***> 写道:
如果取消webview复用会有问题吗?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
wubiao20150321 commented
UIDelegate实现下面的逻辑试下
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
if (!navigationAction.targetFrame.isMainFrame) {
[webView loadRequest:navigationAction.request];
}
return nil;
}