I need to know if its possible to show a window.open pop-up while navigating away from the current page; currently based on event.returnvalue for any change in data we IE shows a confirm popup "Are you sure you want to navigate away?".

On clicking 'OK' to the above question, i need to know if i can show another pop-up and make user stay on the same page without navigating away?

I tried few method, pop-up is showing while i click any anchor link, but if i click X mark on that window.open pop-up, i want it to stay on current page until its been answered, in my case its been navigating away.


Recommended Answers

All 3 Replies

Did you use the window.onbeforeunload event?

yes, i have used window.onbeforeunload event to show the window.open() popup. However, the popup is shown on clicking the anchor link while navigating away from the page; if i close (X) the popup it still navigating away from the page.

I want to stop it to navigate until my popup is answered. Even if the popup is closed using broswer close(X), it should show the same popup again while navigating away from the same page.

Is the above really possible in IE?

Not sure, I think the onbeforeunload is triggered only once.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.