An iOS 6 iPad app shows content in two UIWebViews. If both web views contain a jquery image rotator, only one will work at a time. Running < iOS 6, both work properly.
If the content of the non-animating webview is reloaded, it begins to work, and the other stops. Also, in the simulator ONLY, I can sometimes cause the stopped web view to start (and the other to stop) by clicking/dragging in it.
If one of the web views does NOT have javascript in it, the reloading of the stopped web view does not stop the functioning of the other.
My first thought was this was a focus issue, but the last bit seems to disprove that, and point so some kind of pollution between the two web views. The two rotators have the same selectors and same js scripts, but the js files are cached locally and are renamed uniquely to eliminate any stepping-on during the caching process.
I can't find anything in the iOS 6 release notes to describe a change in focus between different UIWebViews.
The web views are in an XIB, but but not siblings of the same parent UIView.
The desired behavior is to have neither of the web views go to sleep, obviously.
JavaScript works in multiple UIWebViews but it depends on the JavaScript. Using JQuery or other external JavaScript code can be a problem in case you link it with a href. You can solve these issues by copying the code of all external JavaScript libraries into your web page HTML. This is the reason why simple JavaScript works fine. Example:
This is a UITableView with a UIWebView in every UITableViewCell. In webViewDidFinishLoad i do [webView stringByEvaluatingJavaScriptFromString:@"document.write('hey hallo'+new Date().getTime())"];
Have you tried making one WebView the size of your 3 webViews and the using 3 iFrames inside that 1 UIWebView that load each javascript enabled page?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With