473,394 Members | 1,944 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,394 software developers and data experts.

Closing browser versus refreshing

Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?

Thanks,

Targus

May 8 '06 #1
8 2588
ds******@hotmail.com said the following on 5/8/2006 2:15 PM:
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?


No. What are you *really* trying to accomplish?

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 8 '06 #2
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?


In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari. The Opera web site claims this is a
feature rather than a bug, although some of us disagree.
May 9 '06 #3
Warren Sarle said the following on 5/8/2006 9:07 PM:
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?
In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari.


Nor in IE, Firefox, Mozilla or any other browser.
The Opera web site claims this is a feature rather than a bug,
although some of us disagree.


Who is "us" that you refer to? Not being able to tell that the browser
closed isn't a bug. Unless there is some reason to differentiate between
navigating away and closing the browser, there is no need to even know that.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 10 '06 #4
Warren Sarle wrote:
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?


In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari. The Opera web site claims this is a
feature rather than a bug, although some of us disagree.


And in the second place, bugs result from programming errors. A feature
that works as designed isn't a bug - if it works contrary to expectation
or an individuals' particular requirements, it might be called an
annoyance but it is not a bug. :-)
--
Rob
Group FAQ: <URL:http://www.jibbering.com/faq/>
May 10 '06 #5
"Randy Webb" <Hi************@aol.com> wrote in message
news:U8********************@comcast.com...
Warren Sarle said the following on 5/8/2006 9:07 PM:
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?


In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari.


Nor in IE, Firefox, Mozilla or any other browser.


IE and Firefox trigger an unload event when the user closes the browser.
Opera does not trigger any event when the user closes the browser.
May 10 '06 #6
Warren Sarle said the following on 5/9/2006 12:04 AM:
"Randy Webb" <Hi************@aol.com> wrote in message
news:U8********************@comcast.com...
Warren Sarle said the following on 5/8/2006 9:07 PM:
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Is there a way to tell when the user closes the browser that doesn't
also happen when a page is merely being refreshed?
In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari.

Nor in IE, Firefox, Mozilla or any other browser.


IE and Firefox trigger an unload event when the user closes the browser.
Opera does not trigger any event when the user closes the browser.


IE and Firefox also trigger that same exact unload event when you do any
of the following:

Click a Favorites to navigate away
Type a URL into the Address Bar and click Go
Click the Home button

And that is just three, there are more.

You have *no way* of knowing whether I closed the browser or did one of
the three above so it is *impossible* to tell if I "closed the browser"
or not, only that the page itself was unloaded. And that is true in
*any* browser.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 10 '06 #7

In article <bv******************************@comcast.com>,
Randy Webb <Hi************@aol.com> writes:
Warren Sarle said the following on 5/9/2006 12:04 AM:
"Randy Webb" <Hi************@aol.com> wrote in message
news:U8********************@comcast.com...
Warren Sarle said the following on 5/8/2006 9:07 PM:
<ds******@hotmail.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
> Is there a way to tell when the user closes the browser that doesn't
> also happen when a page is merely being refreshed?
In the first place, you can't tell when the user closes the browser on
Opera and, reportedly, Safari.
Nor in IE, Firefox, Mozilla or any other browser.


IE and Firefox trigger an unload event when the user closes the browser.
Opera does not trigger any event when the user closes the browser.


IE and Firefox also trigger that same exact unload event when you do any
of the following:

Click a Favorites to navigate away
Type a URL into the Address Bar and click Go
Click the Home button

And that is just three, there are more.

You have *no way* of knowing whether I closed the browser or did one of
the three above so it is *impossible* to tell if I "closed the browser"
or not, only that the page itself was unloaded. And that is true in
*any* browser.


No, you can't tell if the page was unloaded in Opera or Safari.

The original poster apparently wanted to know if there is an event
that:
1) fires when the browser is closed, and
2) does not fire when the page is refreshed.

My point was that there is no event that satisfies (1) on all
browsers, much less both (1) and (2).

--

Warren S. Sarle SAS Institute Inc. The opinions expressed here
sa****@unx.sas.com SAS Campus Drive are mine and not necessarily
(919) 677-8000 Cary, NC 27513, USA those of SAS Institute.
May 10 '06 #8
Warren Sarle said the following on 5/9/2006 2:10 PM:
In article <bv******************************@comcast.com>,
Randy Webb <Hi************@aol.com> writes:
Warren Sarle said the following on 5/9/2006 12:04 AM:
"Randy Webb" <Hi************@aol.com> wrote in message
news:U8********************@comcast.com...
Warren Sarle said the following on 5/8/2006 9:07 PM:
> <ds******@hotmail.com> wrote in message
> news:11**********************@j33g2000cwa.googlegr oups.com...
>> Is there a way to tell when the user closes the browser that doesn't
>> also happen when a page is merely being refreshed?
> In the first place, you can't tell when the user closes the browser on
> Opera and, reportedly, Safari.
Nor in IE, Firefox, Mozilla or any other browser.
IE and Firefox trigger an unload event when the user closes the browser.
Opera does not trigger any event when the user closes the browser.

IE and Firefox also trigger that same exact unload event when you do any
of the following:

Click a Favorites to navigate away
Type a URL into the Address Bar and click Go
Click the Home button

And that is just three, there are more.

You have *no way* of knowing whether I closed the browser or did one of
the three above so it is *impossible* to tell if I "closed the browser"
or not, only that the page itself was unloaded. And that is true in
*any* browser.


No, you can't tell if the page was unloaded in Opera or Safari.

The original poster apparently wanted to know if there is an event
that:
1) fires when the browser is closed, and
2) does not fire when the page is refreshed.

My point was that there is no event that satisfies (1) on all
browsers, much less both (1) and (2).


And my point is that there is no browser that satisfies (1) in *any*
situation so (2) is moot.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
May 10 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: hawkon | last post by:
Hi all, I have an important question to ask about how to trap events when the user close the browser window. I'm a ASP programmer and I have s MSSQL database with a user table where I'm able to...
3
by: Daniel | last post by:
Is there a way to make a javascript do something when the user closes the browser? I would like it to go another url or something. I do not want this script to run when a user clicks on a link on...
2
by: jb61264 | last post by:
Is it possible to refresh a parent browser window when a "child" browser window has been closed using the button in the upper right corner of the browser? When I refer to child window, I mean...
2
by: Derek | last post by:
Hello: I want to capture the event when a browser is closing, to give to the user the posibility of close or no this browser. When the browser is closing, this show a confirm window with two...
1
by: Michel | last post by:
Yes, there is a way of forbidding a form being closed if you create a boolean variable (blnCanClose = False) in the form's Unload event. I didn't read all the responses, but I have just such a form...
1
by: Chirag Malvi | last post by:
hello all, I am developing the web application using ASP.net and VS.2003 IDE. here is the situation which i want to implement. 1) User is browsing some webform. I want to trap this event....
1
by: karthik juneni | last post by:
Hi all, Iam trying to capture windows closing event (i.e) when the user clicks on the "X" button i want to capture that event and want to update some values in the database.I tried two methods...
5
by: sbettadpur | last post by:
Hi, Please help me, Here i have a problem When i am trying to close the main browser i need to popup a confirmation window actually i had a code that is working on IE browser with some...
1
by: bnashenas1984 | last post by:
Hi everyone I'v seen several websites doing what I'm asking now but I don't know how they do it. Lets say we have an E-commerce website that has a shopping cart inside an IFrame which shows what...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.