how to handle iframes/frames dom in the iphone uiwebview

Posted by user217428 on Stack Overflow See other posts from Stack Overflow or by user217428
Published on 2010-04-07T22:38:28Z Indexed on 2010/04/07 22:43 UTC
Read the original article Hit count: 826

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about uiwebview