i want to display a popup with an ad, now this ad should only be displayed when user has closed the parent window (window on which the site was open), i am using \[code\]onunload\[/code\] and also tried \[code\]onbeforeunload\[/code\], but i am unable to track whether the user has clicked on refresh button or \[code\]onunload\[/code\] button. is there any way i can track the user action (\[code\]refresh or tab/browser close\[/code\]), is there any alternative with which i can recognize the user actions. can anyone please help with this.