Scripting question for brainiacs

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • 2MuchMark
    Mark of 2Much.net
    • Aug 2004
    • 50934

    #1

    Scripting question for brainiacs

    Is there a way to refresh a parent page from a pop-up?

    For example,

    Imagine you have a page with a link that says "click here to sign up". When clicked a pop-up opens requesting the usual info. Once completed, the user can close that window and cause the previous or parent window to automatically refresh.

    Suggestions?
  • k0nr4d
    Confirmed User
    • Aug 2006
    • 9231

    #2
    The only thing I can think of is to do it using http push or comet.
    - Source page that spawns popup has jquery requesting blah.php every second waiting for a value of "true"
    - Source page loads popup
    - Popup shows whatever, onUnload it runs a script to set blah.php to true
    - Source page get's it's true signal and does whatever

    Can be made more "live" using http push but that's the idea basically here.
    Last edited by k0nr4d; 10-02-2013, 12:05 PM.
    Mechanical Bunny Media
    Mechbunny Tube Script | Mechbunny Webcam Aggregator Script | Custom Web Development

    Comment

    • alcstrategy
      Confirmed User
      • May 2012
      • 124

      #3
      I think you can do this with native javascript and the window object and using window.opener to control the window which triggered the popup

      Comment

      • Colmike9
        (>^_^)b
        • Dec 2011
        • 7217

        #4
        Parent page:
        Code:
        <script type="text/javascript">
            function OpenPopup() {
                window.open('ChildPopupWindows.aspx', '', 'width=200,height=100');            
            };
        </script>
        
        <input type="button" value="Open popup" onclick="javascript: return OpenPopup()" />
        Child Page:
        Code:
        <script type="text/javascript">
            function CloseWindow() {
                window.close();
                window.opener.location.reload();
            }
        </script>
        
        <asp:Button ID="btnServer" runat="server" OnClick="btnServer_Click" Text="Request server" />
            <br />        
            <input type="button" value="Close Window" onclick="javascript: return CloseWindow();" />
        C#:
        Code:
        protected void btnServer_Click(object sender, EventArgs e)
            {
        
            }

        Or something like this in the child page using window.opener:
        Code:
        <script>
            window.onunload = refreshParent;
            function refreshParent() {
                window.opener.location.reload();
            }
        </script>
        Join the BEST cam affiliate program on the internet!
        I've referred over $1.7mil in spending this past year, you should join in.
        I make a lot more money in the medical field in a lab now, fuck you guys. Don't ask me to come back, but do join Chaturbate in my sig, it still makes bank without me touching shit for years..

        Comment

        Working...