473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
2 1554
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mat | last post by:
How can I detect when a link has been clicked but the new page is still in the process of loading? The document.location.href property still displays the current location (understandably) not the...
23
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
3
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action...
3
by: someone | last post by:
Hi, Is it possible to detect if the user has shut down the window holding my ASP2.0 page and/or if the user goes to another page? For my application I need the user to click on the EXIT button...
2
by: sylvain | last post by:
is there a simple way to detect a web window closing when the user hit the X of the browser ? I want to display a message to the user when he goes out of my web page. I try to detect it by using...
4
by: nrocha | last post by:
Hello, I've been trying to detect when a user closes a page or navigates away from it. This is part of a solution for locking pages (that is, if a user enters a page, no one else can enter it...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.