简体   繁体   中英

redirect to other page once click close the current page in asp.net

I am new to JavaScript Programming. What I want to do is the following: I am opening popup window for the user to print something. once he finishes, he will close the page. I want the portal to open another page once he closes this page. I tried the following:

<body onbeforeunload="window.open('BondData.aspx');">

but it does not work. Can you please guide me to an idea where I can get this working?

Thanks in advance

try this:

Add this code on page on which you going to close

<script >
window.onbeforeunload =      

  function ()
    {

    window.open('NewPage.aspx');
    };
</script >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM