Search Results

Search found 1 results on 1 pages for 'genericdan'.

Page 1/1 | 1 

  • getClientRects javascript method supported on iPhone?

    - by genericdan
    Trying to find the top-most visible element in a UIWebView. I am using a JS method to do this, which works great in Safari, but never executes past the getClientRects method when executed from a UIWebView. The elements I'm interested are all of class="h". Here's the javascript which is called from [webView stringByEvaluatingJavaScriptFromString:@"findTopElement()"]; Javascript: function findTopElement() { var pars = document.getElementsByClassName("h"); alert("findingTopElement: num pars:" + pars.length); for (var i = 0; i < pars.length; i++) { var para = pars[i]; alert("checking par " + para.id); var rects = para.getClientRects(); alert("checking rects " + rects.length); for (var j = 0; j < rects.length; j++) { var r = rects[j]; if (r.top > 0 && r.bottom > 0) { alert("success: " + para.id); return para.id; } } } return -1; } Is it possible element getClientRects function is not supported in a UIWebView?

    Read the article

1