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 Bristersr. DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ryan ChongBusiness Systems Analyst , ex-Senior Application EngineerCommented:
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.

js/uglipop.js:
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';

        yourFunction();
    }

    function yourFunction() {
        alert("Page will be refreshed");
        location.reload();
    }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 () {
                uglipop({
                    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;
                    //alert(foo);
                    setTimeout("window.location='" + foo + "'", 100);
                }, false);
            }
        </script>
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.