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 9044 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