• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 72
  • Last Modified:

Redirect on Javascript window close

I have a script that is popping a window (uglipop) from vb code

ScriptManager.RegisterClientScriptBlock(Me, Me.GetType(), "script", "$(document).ready(function () { custom1(); });", True)

On close of that window how do I reload the current page?
Larry Brister
Larry Brister
1 Solution
Ryan ChongCommented:
I believe this is linked to your previous question.

you got to download a copy of https://cdn.jsdelivr.net/npm/uglipop@1.0.0/uglipop.js
and place it in your local drive, like:

<script src="js/uglipop.js"></script>

Open in new window

and then edit the function remove() in case you need to add your custom function after that.

function remove() {
        doc.getElementById('uglipop_overlay_wrapper').style.display = 'none';
        doc.getElementById('uglipop_overlay').style.display = 'none';
        doc.getElementById('uglipop_content_fixed').style.display = 'none';


    function yourFunction() {
        alert("Page will be refreshed");

Open in new window

Larry Bristersr. DeveloperAuthor Commented:
Hey ryan,
 That put me on the right track.

But it was only after I added the additional function on the page that it worked.      
(document.getElementById('closeButton').addEventListener('click', function (e) {.... )

 <script type="text/javascript">
            var dStatString = document.getElementById('<%= PaymentStatusFlag.ClientID%>').value;
            var custom1 = function () {
                    class: 'put', //styling class for Modal
                    source: 'html',
                    content: '<div class="upop"><br /><br /><br />' + dStatString + '<div id="footer"><button id="closeButton">Close</button></div></div>'

                document.getElementById('closeButton').addEventListener('click', function (e) {
                    var res = window.location.href;
                    var uri = res.replace("%2f", "/");
                    var lastslashindex = uri.lastIndexOf('/');
                    var result = uri.substring(lastslashindex + 1);
                    var foo = 'GlobalPaymentsSMSPayment4.aspx?/' + result;
                    // var foo = 'http://membersv4.everyware.com/GlobalPaymentsSMSTextLandingALT.aspx?/' + result;
                    setTimeout("window.location='" + foo + "'", 100);
                }, false);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now