2016-08-17 33 views

回答

0

如果iFrame中都存在,你需要得到他们的内部文件做鼠标和键盘操作。对于UIWebView或WKWebView,这意味着将2行添加到脚本的开头以插入到网页中。例如:

NSString *[email protected]"var iFrame=document.getElementById('idOfFrame'); \ 
          var innerDoc=iFrame.innerDocument || iFrame.contentWindow.document; \ 
          //Now do other things w/ innerDoc instead of document 
          "; 

现在,您将插入您的脚本。

[self.webView stringByEvaluatingJavaScriptFromString:scriptToInsert]; 
+0

谢谢伊恩,我会检查你的代码... –

相关问题