I have a parent page which opens a popup window (using window.open...) This popup has abutton which opens another popup window but closes itself at the same time. If the user closes the 2nd popup I want the previous popup to open again. I am using VWD
and VB to code this application. I am looking for some sort of unload event that can detect if a user closes the popup window. I don't want to put a button on this 2nd popup, instead I just want to fire my code after the user closes using the upper right-hand
'X'.
WhiteBearMik...
Member
22 Points
58 Posts
Detect if User Closes Page
Mar 15, 2012 08:14 PM|LINK
I have a parent page which opens a popup window (using window.open...) This popup has abutton which opens another popup window but closes itself at the same time. If the user closes the 2nd popup I want the previous popup to open again. I am using VWD and VB to code this application. I am looking for some sort of unload event that can detect if a user closes the popup window. I don't want to put a button on this 2nd popup, instead I just want to fire my code after the user closes using the upper right-hand 'X'.
Thanks in advance.
Ruchira
All-Star
44216 Points
7184 Posts
MVP
Re: Detect if User Closes Page
Mar 16, 2012 05:09 PM|LINK
Hello,
You can use onbeforeunload method in javascript.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: Detect if User Closes Page
Mar 19, 2012 05:08 AM|LINK
Hi
You can use the code like this:
<script type="text/javascript"> window.onbeforeunload = ToPrevious; function ToPrevious() { var PreviouseURL = document.referrer; window.open(PreviouseURL,"Previouse"); } </script>Hope it helpful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework