iOS 6 multiple UIWebViews: Javascript only runs in one

前端 未结 2 1957
无人及你
无人及你 2021-02-04 17:44

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.

相关标签:
2条回答
  • 2021-02-04 18:15

    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:

    Screenshot of JavaScript in multiple web views

    This is a UITableView with a UIWebView in every UITableViewCell. In webViewDidFinishLoad i do [webView stringByEvaluatingJavaScriptFromString:@"document.write('hey hallo'+new Date().getTime())"];

    0 讨论(0)
  • 2021-02-04 18:27

    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?

    0 讨论(0)
提交回复
热议问题