How to Redirect the Parent Window to a New URL After Clicking on a Child Window Button

104 3
    • 1). Right-click the HTML file that you use in your child window. Click "Open With," then click your HTML editor.

    • 2). Create the JavaScript function to redirect the parent window. Add the following code to the head section of your HTML file:

      <script language="javascript">
      function redirectParent()
      {
      window.opener.document.location("newpage.htm");
      }
      </script>

      Replace "newpage.htm" with the Web page to which you want to send the user.

    • 3). Link the function with a button or other HTML element you want to use to trigger the redirect. The following code links a button to the function created in Step 2:

      <input type="button" value="Click to Redirect" onclick="redirectParent()">

Source...
Subscribe to our newsletter
Sign up here to get the latest news, updates and special offers delivered directly to your inbox.
You can unsubscribe at any time

Leave A Reply

Your email address will not be published.