iFrame receives rendering in iOS 7, but in iOS 8, the iFrame request built into UIWeview fails with error 999 (Cancel). It appears that the iFrame request is being canceled as the main request is still being executed ( webView.isLoading returns TRUE). Thus, it shows empty space instead of iFrame in web view.
This issue applies to iOS 8. Please provide a code snippet so that the iFrame is successfully displayed in the web view (iOS 8).
NSString *HTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\">\n" "iframe { max-width: 100%%; width: auto; height: auto; }" "img { max-width: 100%%; width: auto; height: auto; }" ....]; [cell.webView loadHTMLString:HTML baseURL:[NSURL URLWithString:@"http://"]];
Then the webView delegate functions are called in the user cell (cell): -
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { return YES; } - (void)webViewDidFinishLoad:(UIWebView *)webView { … } - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{ NSLog(@"%@",error); }
In iOS 8, an iFrame request is initiated in shouldStartLoadWithRequest and fails in didFailLoadWithError with error 999 :
Error Domain=NSURLErrorDomain Code=-999 "The operation couldn't be completed. (NSURLErrorDomain error -999.)" UserInfo=0x7ff6cb609580 {NSErrorFailingURLStringKey
At this point, the value of webView.isLoading true, since the main request is not yet complete. Is there a way to invoke an iFrame request after the main request has completed?
source share