issue with refreshing pages using JavaScript.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CF FAN
    New Member
    • Mar 2008
    • 50

    issue with refreshing pages using JavaScript.

    We have an issue with refreshing pages using JavaScript.
    We have got three pages. From page 1, page 2 is opened by window.open and from page 2, page 3 open up by window.open and also closes page 2. Now on submitting page 3, can we refresh page 1 ?
    Is there any method to do this using JavaScript ?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    i think you just have to pass the reference to the windows ... in win2 you have the refernce to the opener as:

    [CODE=javascript]
    // declare that globally in your win2
    var orig_opener = window.opener;
    [/CODE]
    now you could use that in win3 with:

    [CODE=javascript]var orig_opener = window.opener.o rig_opener;
    [/CODE]
    now you have the reference to win1 stored in orig_opener.

    kind regards

    Comment

    • hsriat
      Recognized Expert Top Contributor
      • Jan 2008
      • 1653

      #3
      That's possible. Do it like this.

      File a.htm[html]<h1>File A</h1>
      <button onclick="window .open('b.htm'); ">Open B</button>[/html]
      File b.htm[html]<h1>File B</h1>
      <button onclick="window .open('c.htm'); ">Open C</button>[/html]
      File c.htm[html]<h1>File C</h1>
      <script>
      var w = window.opener.o pener;
      window.opener.c lose();
      </script>
      <button onclick="w.loca tion.replace('a .htm');">Refres h A</button>[/html]


      Harpreet


      [EDIT: Sorry Gits, I didn't see your post before posting]

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        :) no problem ... no need to apologize ... may be your post makes it a bit more clear in case the OP wouldn't know how to use the opener ...

        kind regards

        Comment

        • hsriat
          Recognized Expert Top Contributor
          • Jan 2008
          • 1653

          #5
          Originally posted by gits
          :) no problem ... no need to apologize ... may be your post makes it a bit more clear in case the OP wouldn't know how to use the opener ...

          kind regards
          Well, if that would be the case, I'll take my sorry back. :D

          Regards

          Comment

          • CF FAN
            New Member
            • Mar 2008
            • 50

            #6
            ok big thanksss. this thing we have tried as u post. it is perfect in this case.thankssss. ..........


            now we have the problem with more than 3 windows opening. So need to know if we can set a name for the first page and then reference it.

            Comment

            • gits
              Recognized Expert Moderator Expert
              • May 2007
              • 5390

              #7
              just pass the reference to every new opened window as we showed you ...

              kind regards

              Comment

              • kunal pawar
                Contributor
                • Oct 2007
                • 297

                #8
                on 3rd page just use javascript code window.opener.l ocation.reload( );

                Comment

                • CF FAN
                  New Member
                  • Mar 2008
                  • 50

                  #9
                  ok Thanks ..working fine

                  Comment

                  Working...