Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Window not refreshing after popup closed  (Read 9257 times)

0 Members and 1 Guest are viewing this topic.

Bannana97

    Topic Starter


    Intermediate
  • Owner of HerbertsWorld Corporation
    Window not refreshing after popup closed
    « on: June 10, 2009, 01:42:51 PM »
    This is designed to refresh the original window when the popup widow is closed. It isn't working.

    Code: [Select]
    <script type='text/javascript'>
    function lola(p) {
    if(p.closed == true) {
    return false;
    }
    else {
    return true
    }
    }
    function run(p) {
    lola(p);
    }
    function Wait(time,p) {
    setTimeout("run(p);", time);
    }
    function CSH() {
    p = window.open('http://quackit.com/common/link_builder.cfm','popUpWindow','height=500,width=400,left=100,top=100,resizable=yes,
    scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no, status=yes');
    if(Wait(100, p)) {
    location.reload(true);
    }
    }
    </script>
    « Last Edit: June 10, 2009, 01:52:28 PM by kpac »
    Thanks
    Bannana97

    kpac

    • Web moderator
    • Moderator


    • Hacker

    • kpac®
    • Thanked: 184
      • Yes
      • Yes
      • Yes
    • Certifications: List
    • Computer: Specs
    • Experience: Expert
    • OS: Windows 7
    Re: Window not refreshing after popup closed
    « Reply #1 on: June 10, 2009, 01:54:21 PM »
    Use window.location.reload() to reload the page.

    Bannana97

      Topic Starter


      Intermediate
    • Owner of HerbertsWorld Corporation
      Re: Window not refreshing after popup closed
      « Reply #2 on: June 10, 2009, 01:55:40 PM »
      How would I loop the (

      if(Wait(100,p)) {
      location.reload(true)
      }
      )
      part?
      Thanks
      Bannana97

      kpac

      • Web moderator
      • Moderator


      • Hacker

      • kpac®
      • Thanked: 184
        • Yes
        • Yes
        • Yes
      • Certifications: List
      • Computer: Specs
      • Experience: Expert
      • OS: Windows 7
      Re: Window not refreshing after popup closed
      « Reply #3 on: June 10, 2009, 01:59:18 PM »
      What is the argument and condition? You'd either be using a for or a while loop.

      Bannana97

        Topic Starter


        Intermediate
      • Owner of HerbertsWorld Corporation
        Re: Window not refreshing after popup closed
        « Reply #4 on: June 10, 2009, 02:00:55 PM »
        O-my-gosh! It won't work.

        Can you just give me one small thing that will do this:

        if "p" .closed = true then reload the page or else wait 1 second and repeat

        That would be best...
        What I am using this for:
        I am making a "create new page" link. It will open "p" as a new window. When they close the window, it refreshes the original window.
        Thanks
        Bannana97

        kpac

        • Web moderator
        • Moderator


        • Hacker

        • kpac®
        • Thanked: 184
          • Yes
          • Yes
          • Yes
        • Certifications: List
        • Computer: Specs
        • Experience: Expert
        • OS: Windows 7
        Re: Window not refreshing after popup closed
        « Reply #5 on: June 10, 2009, 02:13:51 PM »
        LOL me and loops = no no.

        I never quite got the hang of them in JS. Maybe Rob could lend a helping hand? ;D

        Bannana97

          Topic Starter


          Intermediate
        • Owner of HerbertsWorld Corporation
          Re: Window not refreshing after popup closed
          « Reply #6 on: June 10, 2009, 02:14:57 PM »
          Okay, then this is saying Object Expected; I am looping it this way:

          function CSH(p) {
          setTimeOut("function(p) { if(true == p.closed) { window.location.reload(true); } else { CSH(p); return false; } }", 10);
          }
          Thanks
          Bannana97

          kpac

          • Web moderator
          • Moderator


          • Hacker

          • kpac®
          • Thanked: 184
            • Yes
            • Yes
            • Yes
          • Certifications: List
          • Computer: Specs
          • Experience: Expert
          • OS: Windows 7
          Re: Window not refreshing after popup closed
          « Reply #7 on: June 10, 2009, 02:23:01 PM »
          Is there a JS statement called "closed"? I don't think there is...You'll have to declare that somehow by using what's available.
          Unless you tell the browser what "p.closed" means, then it's not going to work.

          Bannana97

            Topic Starter


            Intermediate
          • Owner of HerbertsWorld Corporation
            Re: Window not refreshing after popup closed
            « Reply #8 on: June 10, 2009, 02:35:31 PM »
            How would I tell it?
            This is a code I got from a website:

            function checkIfClosed() {
            newWindow = window.open("http://", "popupWindow", "scrollbars=no;")
            if (newWindow.closed)
               ifClosed()
            else
               ifNotClosed()
            }
            Thanks
            Bannana97

            kpac

            • Web moderator
            • Moderator


            • Hacker

            • kpac®
            • Thanked: 184
              • Yes
              • Yes
              • Yes
            • Certifications: List
            • Computer: Specs
            • Experience: Expert
            • OS: Windows 7
            Re: Window not refreshing after popup closed
            « Reply #9 on: June 10, 2009, 02:37:04 PM »
            Maybe it is right so, it kind of rings a bell with me.

            I really can't help with the loop though, sorry.

            Bannana97

              Topic Starter


              Intermediate
            • Owner of HerbertsWorld Corporation
              Re: Window not refreshing after popup closed
              « Reply #10 on: June 10, 2009, 02:44:49 PM »
              K, www.webstarts.com did it without looping.
              Have any clue how to make a button that will refresh that window onClick that could be INSIDE the popup? That's what they did.
              Thanks
              Bannana97

              Rob Pomeroy



                Prodigy

              • Systems Architect
              • Thanked: 124
                • Me
              • Experience: Expert
              • OS: Other
              Re: Window not refreshing after popup closed
              « Reply #11 on: June 10, 2009, 02:50:11 PM »
              Better example of setTimeOut() usage >here<.
              Only able to visit the forums sporadically, sorry.

              Geek & Dummy - honest news, reviews and howtos

              Bannana97

                Topic Starter


                Intermediate
              • Owner of HerbertsWorld Corporation
                Re: Window not refreshing after popup closed
                « Reply #12 on: June 10, 2009, 02:55:10 PM »
                So... This?

                Code: [Select]
                <script type='text/javascript'>
                function CSH(p) {
                stop = false

                if(p.closed) {
                stop = true;
                window.location.reload();
                }
                if(stop == false) {
                setTimeout("CSH(p)", 3000);
                }
                }
                </script>
                Thanks
                Bannana97

                Bannana97

                  Topic Starter


                  Intermediate
                • Owner of HerbertsWorld Corporation
                  Re: Window not refreshing after popup closed
                  « Reply #13 on: June 10, 2009, 02:56:56 PM »
                  Yay it worked! Thanks for all your help!
                  Thanks
                  Bannana97

                  Rob Pomeroy



                    Prodigy

                  • Systems Architect
                  • Thanked: 124
                    • Me
                  • Experience: Expert
                  • OS: Other
                  Re: Window not refreshing after popup closed
                  « Reply #14 on: June 11, 2009, 02:08:23 AM »
                  Well done!
                  Only able to visit the forums sporadically, sorry.

                  Geek & Dummy - honest news, reviews and howtos

                  kpac

                  • Web moderator
                  • Moderator


                  • Hacker

                  • kpac®
                  • Thanked: 184
                    • Yes
                    • Yes
                    • Yes
                  • Certifications: List
                  • Computer: Specs
                  • Experience: Expert
                  • OS: Windows 7
                  Re: Window not refreshing after popup closed
                  « Reply #15 on: June 11, 2009, 06:55:11 AM »
                  Glad you got it going. :)

                  Bannana97

                    Topic Starter


                    Intermediate
                  • Owner of HerbertsWorld Corporation
                    Re: Window not refreshing after popup closed
                    « Reply #16 on: June 11, 2009, 06:32:48 PM »
                    Lol, I get most of programming and I am only an 11 year old XD

                    I am a CPU freak :S I am on the CPU about 8/24 of my day ..

                    But thanks for your help kpac and rob :D
                    If you want, you can signup on my website and make a free website to test things on.

                    http://herbertsworld.com/index.php
                    -- Go there. index.html says coming soon. F_F
                    Thanks
                    Bannana97

                    Rob Pomeroy



                      Prodigy

                    • Systems Architect
                    • Thanked: 124
                      • Me
                    • Experience: Expert
                    • OS: Other
                    Re: Window not refreshing after popup closed
                    « Reply #17 on: June 12, 2009, 03:58:57 AM »
                    Er, I have a development web server in my living room and a production server at the other end of a hundred meg pipe, but thanks!
                    Only able to visit the forums sporadically, sorry.

                    Geek & Dummy - honest news, reviews and howtos

                    Bannana97

                      Topic Starter


                      Intermediate
                    • Owner of HerbertsWorld Corporation
                      Re: Window not refreshing after popup closed
                      « Reply #18 on: June 12, 2009, 09:57:56 AM »
                      Ok :D
                      But someone had to join.. It says theres 4 hosted sites...
                      Thanks
                      Bannana97

                      Bannana97

                        Topic Starter


                        Intermediate
                      • Owner of HerbertsWorld Corporation
                        Re: Window not refreshing after popup closed
                        « Reply #19 on: June 12, 2009, 09:58:07 AM »
                        Maybe kpac?
                        Thanks
                        Bannana97

                        kpac

                        • Web moderator
                        • Moderator


                        • Hacker

                        • kpac®
                        • Thanked: 184
                          • Yes
                          • Yes
                          • Yes
                        • Certifications: List
                        • Computer: Specs
                        • Experience: Expert
                        • OS: Windows 7
                        Re: Window not refreshing after popup closed
                        « Reply #20 on: June 12, 2009, 12:22:28 PM »
                        How'd you guess?

                        Bannana97

                          Topic Starter


                          Intermediate
                        • Owner of HerbertsWorld Corporation
                          Re: Window not refreshing after popup closed
                          « Reply #21 on: June 12, 2009, 12:52:12 PM »
                          Because your the only other one I told about it..
                          Thanks
                          Bannana97

                          kpac

                          • Web moderator
                          • Moderator


                          • Hacker

                          • kpac®
                          • Thanked: 184
                            • Yes
                            • Yes
                            • Yes
                          • Certifications: List
                          • Computer: Specs
                          • Experience: Expert
                          • OS: Windows 7
                          Re: Window not refreshing after popup closed
                          « Reply #22 on: June 12, 2009, 01:08:50 PM »
                          Heh, okay. I'll get a bit more time in a few days to try a few more things with it.

                          Bannana97

                            Topic Starter


                            Intermediate
                          • Owner of HerbertsWorld Corporation
                            Re: Window not refreshing after popup closed
                            « Reply #23 on: June 12, 2009, 01:57:32 PM »
                            K. If you have any suggestions for it, tell me (via computerhope forums private message)
                            Thanks
                            Bannana97