授权界面一般授权成功后需要跳过之前授权的界面,第一种方式backList可以跳过授权界面
NSArray<WKBackForwardListItem *> *backList = wkWebView.backForwardList.backItem;
if(backList[_index]) {
[wkWebViewgoToBackForwardListItem:backList[_index]];
}
第二种方式通过调用web的replace修改历史界面url
- (void)call:(WKWebView*)webViewurl:(NSString*)url{
if ([[NSThread currentThread] isMainThread]) {
NSString *javascriptCommand = [NSString stringWithFormat:@"%@('%@');", @"window.location.replace", url];
[webViewevaluateJavaScript:javascriptCommandcompletionHandler:nil];
}
else {
dispatch_sync(dispatch_get_main_queue(), ^{
NSString *javascriptCommand = [NSString stringWithFormat:@"%@('%@');", @"window.location.replace", url];
[webViewevaluateJavaScript:javascriptCommandcompletionHandler:nil];
});
}
}