Get current Url from radwindow

4 posts, 0 answers
  1. Hugh
    Hugh avatar
    10 posts
    Member since:
    Nov 2014

    Posted 23 Nov 2014 Link to this post

    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.
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 24 Nov 2014 Link to this post

    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.

     
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Hugh
    Hugh avatar
    10 posts
    Member since:
    Nov 2014

    Posted 12 Feb 2015 in reply to Marin Bratanov Link to this post

    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.
  5. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3599 posts

    Posted 13 Feb 2015 Link to this post

    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.

     
Back to Top