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

Get current Url from radwindow

3 Answers 313 Views
Window
This is a migrated thread and some comments may be shown as answers.
Hugh
Top achievements
Rank 1
Hugh asked on 23 Nov 2014, 06:36 AM
Hello, I am struggling getting the current url for the radwindow.  I always seem to obtain the original url. 

I have a radwindow hosting a webpage where I am able to perform searches internally,  Just as google, yahoo etc, the url is populated with a string of information identifying the performed search.  I need to pull the new url from the radwindow and pass it to a model popup I am using to save the string.

I have tried several options but none seem to get anything but the original url.
radwindow.get_NavigateUrl()
radwindow.Geturl() - doesn't work at all.
document.getElementById("radwindow").src

Please help,
thanks.

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Nov 2014, 12:58 PM

Hello Steve,

RadWindow may not be able to access the content page due to cross-site origin limitations in the browser, and the src attribute of the frame is not updated by the browsers when navigation occurs inside. Thus, if you need the current URL, you would need to access the iframe's window object as shown here: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html. Here is a basic sample that can be added on the page where the RadWIndow is declared:

function getWndCurrentUrl() {
    var wnd = $find("<%=RadWindow1.ClientID%>");
    try {
        //wnd.get_contentFrame().contentWindow is the window object of the page inside the iframe
        alert(wnd.get_contentFrame().contentWindow.location.href);
    } catch (ex) {
        alert(ex);
    }
}



Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Hugh
Top achievements
Rank 1
answered on 13 Feb 2015, 01:23 AM
Evening,  This code works great for IE 10-11 but I get an access denied error when using Chrome.  Is there another option for Chrome?

thanks.
0
Marin Bratanov
Telerik team
answered on 13 Feb 2015, 09:52 AM

Hi Steve,

I am afraid there is nothing specific in terms of code related to Chrome. This error means the iframe's content is from another domain and the browser will not let you access it. And there is nothing we can do about that because this limitation lies in the browser's JS engine and is considered a security feature. You would experience the same issue if you replace the RadWindow with a simple iframe.

Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Window
Asked by
Hugh
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Hugh
Top achievements
Rank 1
Share this question
or