您的当前位置:首页正文

UIWebView response status code 3

来源:要发发知识网
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    DELog(@" webViewDidFinishLoad request %@ ",webView.request);
// 判断 请求不超过 3次
    if ([webView stringByEvaluatingJavaScriptFromString:@"document.body.innerHTML"].length < 1 && self.blankPageCount < 3)
    {// 空白页
        ++self.blankPageCount;
        DELog(@"Reconstructing request...  %@",self.lastRequest);
        NSString *uniqueURL = [NSString stringWithFormat:@"%@?t=%@", self.lastRequest.URL, [[NSProcessInfo processInfo] globallyUniqueString]];
        [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:uniqueURL] cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:10.0]];
    } else {
        self.blankPageCount = 0;
    }
}