KKJSBridge icon indicating copy to clipboard operation
KKJSBridge copied to clipboard

如何实现重定向页面的跳转

Open clq1983 opened this issue 3 years ago • 4 comments

我发现如果有302跳转,就会跳转不过去,页面卡死,我实现下面的方法也没有效果:

clq1983 avatar Apr 20 '21 11:04 clq1983

实现如下方法,还是没有效果,请问楼主这个问题有什么好的方法解决不?

  • (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler { NSURLRequest *redirectRequest = request;

    if (completionHandler) { completionHandler(redirectRequest); } }

clq1983 avatar Apr 20 '21 11:04 clq1983

如果取消webview复用会有问题吗?

karosLi avatar May 11 '21 03:05 karosLi

去掉复用也会有

发自我的 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.

clq1983 avatar May 11 '21 10:05 clq1983

UIDelegate实现下面的逻辑试下

  • (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {
    if (!navigationAction.targetFrame.isMainFrame) {
    [webView loadRequest:navigationAction.request];
    }
    return nil;
    }

wubiao20150321 avatar Nov 10 '21 02:11 wubiao20150321