By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,760 Members | 1,585 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,760 IT Pros & Developers. It's quick & easy.

How to detect in a javascript function that the page is about to postback

P: n/a
Hi all,

In my ASP.NET application, I am trying to detect in a javascript
function, which is triggered by the event onbeforeunload, that if the
window is getting closed beacuse its a post back or if the user has
clicked the X button of the browser. Is there a way in javascript to
know that a postback is about to happen i.e. the user has clicked a
button (asp.net control).

thanks

Mar 28 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
there is no supported method. the most common trick is to check the mouse
coordinates, they will be negative for the close button.

-- bruce (sqlwork.com)

<ta***********@gmail.com> wrote in message
news:11*********************@g10g2000cwb.googlegro ups.com...
Hi all,

In my ASP.NET application, I am trying to detect in a javascript
function, which is triggered by the event onbeforeunload, that if the
window is getting closed beacuse its a post back or if the user has
clicked the X button of the browser. Is there a way in javascript to
know that a postback is about to happen i.e. the user has clicked a
button (asp.net control).

thanks

Mar 29 '06 #2

P: n/a
Not sure if this is what you're wanting but it works great:
http://aspnet.4guysfromrolla.com/articles/042005-1.aspx

"ta***********@gmail.com" <ta***********@gmail.com> wrote in
news:11*********************@g10g2000cwb.googlegro ups.com:
Hi all,

In my ASP.NET application, I am trying to detect in a javascript
function, which is triggered by the event onbeforeunload, that if the
window is getting closed beacuse its a post back or if the user has
clicked the X button of the browser. Is there a way in javascript to
know that a postback is about to happen i.e. the user has clicked a
button (asp.net control).

thanks


Mar 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.