iframe contentWindow property not working for Google Chrome

2 posts, 0 answers
  1. Hans-Jürgen
    Hans-Jürgen avatar
    13 posts
    Member since:
    Oct 2012

    Posted 31 May 2012 Link to this post


    in my app I have a radhtmlplaceholder that loads a page containing an applet.
    When the page has finished loading and the applet is loaded I can call a javafunction on the applet using




    iframe = simplesearchquerymarvinappletEditable.HtmlPresenter.Children[0] as HtmlElement;




    "id", "myID");





    myhtmlobj = HtmlPage.Document.GetElementById("myID").GetProperty("contentWindow") as HtmlObject;






    All that works well on IE (v8+9) and FF (v12), but **NOT** using Google Chrome (v19).

    Accoring the Web Google Chrome does not support the contentWindow . Instead (accoring the Web) you need to use the contentDocument property.

    Question: How do I call my Javascript function when I obtain my contentDocument object ???
    I already tried to call invoke on the contentDocument object but  this (as kind of expected) did not work.

    Any help is appreciated.
    Best regards

  2. Petar Mladenov
    Petar Mladenov avatar
    2991 posts

    Posted 01 Jun 2012 Link to this post

    Hello Hans,

    We managed to reproduce this issue. The following code is OK in IE but it dos not work in Chrome:

    private void placecHolder_UrlLoaded(object sender, EventArgs e)
            // HtmlDocument requires using System.Windows.Browser.
            holder = ((App.Current.RootVisual as UserControl).Content as Grid).Children[0] as RadHtmlPlaceholder;
            HtmlElement iframe = (HtmlElement)holder.HtmlPresenter.Children[0];
            HtmlWindow contentWindow = iframe.GetProperty("contentWindow") as HtmlWindow;
            HtmlDocument contentDocument= iframe.GetProperty("contentDocument") as HtmlDocument;
            HtmlDocument document = contentWindow.GetProperty("document") as HtmlDocument;
            // Hook up the simple JavaScript method HTML button.
                new EventHandler(this.CallGlobalJSMethod));
                //new EventHandler(this.CallGlobalJSMethod));
    The JS function is not executed on button's Click in Chrome. We don't believe this is related to HTMLPlaceholder - it simply wraps an iframe object. We changed this ticket's type to Forum. Hope someone from our community has resolved or workarounded this issue.

    Kind regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top