. . .

Control parent window’s location from an iframe

Published: October 12, 2010

On This Page

    Step 1:  In your parent window document add a function

    function changeURL(url)
    {
        if( url == ""){
            url = document.location.href;
        }
        document.location.href = url;
    }

     

    Step 2: In iframe document call this function to change URL of parent window

    parent.document.changeURL('http://www.google.com/');

     If you only want to refresh parent’s window, use the following statement.

    parent.document.location.reload();

     

    Don't forget to share this post

      Let's Build Digital Excellence Together


      • Cost Efficient Solutions.
      • Minimal Timelines.
      • Effective Communication.
      • High Quality Standards.
      • Lifetime Support.
      • Transparent Execution.
      • 24/7 Availability.
      • Scalable Teams.

      Join Our 200+ Happy Clients Across Globe


      Free Consultation.

        Do you need tech help of your startup/business? Experts from our team will get in touch with you.

        Please do not post jobs/internships inquiries here.