This is a migrated thread and some comments may be shown as answers.

Window is not closing via custom button

1 Answer 82 Views
Window
This is a migrated thread and some comments may be shown as answers.
rick
Top achievements
Rank 1
rick asked on 05 Oct 2010, 04:40 PM
I have a web page and it has one textbox and button. User can enter specific url to textbox and clicking button opens a new telerik window. This popup window has cancel button and clicking that button close the window.

For example: When user navigates http://server1/testpage.aspx then user enters http://server1/newpopup.aspx then clicks open button and popup shows up then user clicks cancel button on the newpopup.aspx page window closes. When user types http://server2/newpopup.aspx popup shows up but clicking cancel button does not close the newpopup window and it gives access denied error message. This is not a cross browsing issue because I am trying to close popup window in the popup window control.

//Open popup
        protected void xcBrowseDes_Click(object sender, EventArgs e)
        {
            string destinationURL = txtDESTURL.Text.ToLower().Trim().TrimEnd(new char[] { '/' });
            ScriptManager.RegisterStartupScript(xcBrowseDes, typeof(string), "alertScript1", "Confirm('" + destinationURL+"');",true);
        }

//javascript
function Confirm(par) {

            var oWnd = radopen(par, "Browse");
            var width = $(window).width();
            if (width > 750)
                width = 750;

            oWnd.setSize(width - 15, $(window).height() - 15); 
            
            oWnd.center(true);
            oWnd.set_modal(false);
        }

//javascript closing popup window
  function GetRadWindowClose() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog 
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well) 

            oWindow.close();
        } 

I also tried just window.close() javascript method or self.close() but both methods did not close the window.


1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 08 Oct 2010, 11:36 AM
Hi Rick,

If the context page (newpopup.aspx) comes from a different domain, the error is expected as you cannot access objects from the parent page from within the parent page. The issue is not related to the RadWindow control - you can try getting an access to another JS object in the parent and you will receive the same access denied message. To avoid that, you could try to use document.domain to set the domain property of the document object to the domain of the other page.


Sincerely yours,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
rick
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or