GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Scripting question for brainiacs (https://gfy.com/showthread.php?t=1122623)

2MuchMark 10-02-2013 12:47 PM

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 10-02-2013 01:04 PM

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.

alcstrategy 10-02-2013 01:18 PM

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

Colmike9 10-02-2013 01:19 PM

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>



All times are GMT -7. The time now is 02:33 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123