Sri Lanka .NET Forum
a mission and a vision with .NET

How to check when user click close/back/refresh button in browser and popup the message?

Get Microsoft Silverlight

rated by 0 users
This post has 2 Replies | 2 Followers

Top 75 Contributor
Fast Poster
Points 2,862
Shanga Posted: 02-05-2010 8:39 AM

Hi,

I want to popup a message box to remain the user, when user click close/back/refresh button in browser.

Thanks in advance.

Shangar

  • | Post Points: 30
Top 150 Contributor
Cool Newbie
Points 810

You can use onunload or onbeforeunload events to get your work done. As I understand your idea is to not close or send the user to a different web page. If so you can do something like this:

event.returnValue = "Please do not leave.";

This will prompt a dialog box with Ok and Cancel buttons in it with your message.

Viraj.D.Siriwardana
  • | Post Points: 30
Top 75 Contributor
Fast Poster
Points 2,862

Hi ,

Thanks this is working in IE only  not working with Chrome , Fire Fox. do you have any suggestion for this?

shanga

  • | Post Points: 10
Page 1 of 1 (3 items) | RSS
This space is available for you to advertise. Please contact admin@dotnetforum.lk for more details on how to advertise on the .NET Forum.
Copyright © Sri Lanka .NET Forum. All Rights Reserved. Terms of Use | Privacy Policy