[英]how to handle iframes/frames dom in the iphone uiwebview
in 在
(void) webViewDidFinishLoad: (UIWebView*)webView (无效)webViewDidFinishLoad:(UIWebView *)webView
I inject some javascript to handle the iframes. 我注入一些JavaScript来处理iframe。 eg
例如
stringByEvaluatingJavaScriptFromString:
@"try {
var document = window.document.getElementsByTagName('iframe')[0].contentWindow.document.getElementsByTagName('frame');
} catch (e) {
alert (e.message);
}"
It tells me the iframes document is undefined. 它告诉我iframe文档未定义。 Actually I have tried to print all the properties of contentWindow of iframe, but it's totally empty.
实际上,我尝试打印iframe的contentWindow的所有属性,但是它完全是空的。
I know the webViewDidFinishLoad may be called several times for each frame load. 我知道webViewDidFinishLoad可能会为每个帧加载多次调用。 But I can never get the iframe document.
但是我永远无法获得iframe文档。 I thought there should be at least once all the iframes are ready.
我认为所有iframe至少应该准备好一次。
Could someone please tell me how to get the iframe document to process the dom in the uiwebview? 有人可以告诉我如何获取iframe文档以在uiwebview中处理dom吗?
Thanks 谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.