Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
107
WebDialogWindow
posted

how do you get iFrame of ContentPane through JAVASCRIPT and set the iFrame'src attribute?

  • 24497
    Suggested Answer
    posted

    Hi Joe,

    The simplest way to change url, is to use set_contentUrl, however, get_iframe().src is also possible.
    Note: ContentUrl should be set on server, otherwise, ContentPane will not have iframe object and there is nothing to set.
    Below is example.

    <ig:WebDialogWindow ID="WebDialogWindow1" runat="server" Width="300px" Height="300px">
     <ContentPane ContentUrl="http://www.google.com"></ContentPane>
    </ig:WebDialogWindow>

    <script type="text/javascript">
    function changeUrl()
    {
     var dialog = $find('<%=WebDialogWindow1.ClientID%>');
     if(!dialog)
      return;
     // instance of $IG.LayoutPane class
     var cp = dialog.get_contentPane();
     var old = cp.get_contentUrl();
     var iframe = cp.get_iframe();
     //old = iframe.src;
     cp.set_contentUrl('http://ask.com');
     //iframe.src = 'http://ask.com';
    }
    </script>
    <input type="button" value="change url" onclick="changeUrl()" />