how to handle iframes/frames dom in the iphone uiwebview
- by user217428
in
(void) webViewDidFinishLoad: (UIWebView*)webView
I inject some javascript to handle the iframes. e.g.
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. Actually I have tried to print all the properties of contentWindow of iframe, but it's totally empty.
I know the webViewDidFinishLoad may be called several times for each frame load. But I can never get the iframe document. I thought there should be at least once all the iframes are ready.
Could someone please tell me how to get the iframe document to process the dom in the uiwebview?
Thanks