RadWindow and IFrame Sandbox

2 posts, 0 answers
  1. reza
    reza avatar
    45 posts
    Member since:
    Apr 2011

    Posted 29 Mar 2013 Link to this post

    Hi

    I use 'RadWindowManager' and 'radopen' javadcript function to open and brows extra pages.
    How can I add [sandbox="allow-forms allow-scripts"] to the iframe of the radwindow?

    Thank you very much
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5529 posts

    Posted 01 Apr 2013 Link to this post

    Hi Reza,

    You can get a reference to the iframe in the RadWindow by using the control's Client-side API:
    var oWnd = radopen(url, wndName);
    if(oWnd.get_contentFrame()){
      oWnd.get_contentFrame().setAttribute("sandbox", "allow-forms allow-scripts");
    }

    Note that the popup must be shown already in order to have its iframe created. Thus, the earliest point where the if block can be added is the OnClientShow event. The event handler can be set for the manager if you want it for all RadWindows. The event handler would receive the RadWindow instance as its first parameter, so you can use that.

    All the best,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top