2016-08-17 31 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

謝謝伊恩,我會檢查你的代碼... –

相關問題