I'm displaying two HTML5 documents on my iPad application, using a UIWebView on iOS 6.0.1.
One of them has no problems and I can open and close the webview as much as I want.
The other one can be displayed once and then when I close my web view and want to re-open the document again, the webview shows a black screen.
I haven't prepared the HTML5 documents myself and I don't have much knowledge on HTML5, so I can't tell the difference between them that causes this behavior.
Here's how I create my webview and how I load the HTML5:
UIWebView *theWebView = [[UIWebView alloc] init];
theWebView.scalesPageToFit = YES;
theWebView.clearsContextBeforeDrawing = YES;
theWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
//adjust frame and add to view controller's view here
NSURL *url = [NSURL URLWithString:@"http://www.handypdf.net/davsan"];
[theWebView loadRequest:[NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]];
Everytime I open an HTML5 document, I re-create the web view. So I don't re-use it.
To fix the problem, I tried cleaning the cache, cookies, etc.. explained on these SO answers, but it didn't work.
Here are the links to the problematic and the not-problematic HTML documents:
This one works ok. This one doesn't work the second time.
Also, if you want to check these HTML5 pages online here are the links to them:
This one works ok. This one doesn't work the second time.
This problem does not happen on iOS 5.x. It's also replicable using the iOS simulator. What would you suggest to fix it?
Thx