954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to open a popup after a user closes browser window

Hi Friends,
I need to create an application that will open a popup
when the user closes a window. I can do that easily
via onUnload event of javascript but the catch is that
the popup must open only when we close the window and
not when we submit a form or click a link on the page.
Actually it is a survey which opens only when one
closes the window.
I think i am clear.
Any help will be apreciated.

--
Regards
Abhishek jain

webbee
Newbie Poster
2 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

The only way is with the "onUnload" attribute of the "body" command. You can cause alerts to appear, but trying to open a popup window will undoubtedly fail or cause problems with the vast majority of users. That is because popups are annoying and frequently blocked. I would strongly suggest you find another approach.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 
The only way is with the "onUnload" attribute of the "body" command. You can cause alerts to appear, but trying to open a popup window will undoubtedly fail or cause problems with the vast majority of users. That is because popups are annoying and frequently blocked. I would strongly suggest you find another approach.

What kind of other solution it may be. I want to open a survey if a person does not accept mine product.
Thanks for your advice if you could suggest more it would be great.
--
Regards
Abhishek Jain

webbee
Newbie Poster
2 posts since Nov 2005
Reputation Points: 10
Solved Threads: 0
 

If a user closes their browser window or navigates to a different page, then that's what the user wants to do. Anything that interferes with that process is going to cause irritation. The user should only be presented with a survey if they click a link to a survey.

tgreer
Made Her Cry
Team Colleague
2,118 posts since Dec 2004
Reputation Points: 227
Solved Threads: 37
 
If a user closes their browser window or navigates to a different page, then that's what the user wants to do. Anything that interferes with that process is going to cause irritation. The user should only be presented with a survey if they click a link to a survey.


Hii Guys,

Can anyone Got Solution for it?
We are having same problem, it open window on each time! And we don't want to open each time!
Any Help Will be needed, as i need to do it for one project!

Regardds, Freelance / Freelancing Programmer

freelancerquest
Newbie Poster
4 posts since Jan 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You