473,372 Members | 840 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,372 software developers and data experts.

identifying between refresh and close browser actions

When we refresh the page (F5, or icon in browser), it will first
trigger ONUNLOAD event and then trigger
ONLOAD event. When we close the browser (X on right top icon), it will
trigger ONUNLOAD event.

Now when ONUNLOAD event is triggered, there is no way to distinguish
refresh the page or close the browser.

Here's the code fragment. The logic in window_unload() only applies to
closing the browser, not refreshing the page.

<BODY ONUNLOAD="window_unload()">
function window_unload()
{//logic that only applies to close the browser, not refresh the page.

Anyone knows the workaround to the problem?

Please advise. Thanks!!
Jul 23 '05 #1
1 7852
In article <ba**************************@posting.google.com >,
jr********@hotmail.com enlightened us with...

Now when ONUNLOAD event is triggered, there is no way to distinguish
refresh the page or close the browser.

If you need to care, your code is unsuitable for internet use. This group
assumes your code is for the internet unless otherwise specified.

I might also trigger onunload by moving to another url by typing it, by using
a bookmark, or by clicking a link. How would you handle those?
I might also just close a tab, yet keep my browser open (opera, netscape,

Code your application to be robust and stable and it won't matter if the user
refreshes or closes.

(by the by, I have yet to see a cross-browser "solution" to this problem)

He had a photographic memory that was never developed.

Jul 23 '05 #2

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

Similar topics

by: Matt | last post by:
By using javascript, is it possible to disable the REFRESH functionality (F5 or refresh icon) in a browser? Please advise. Thanks!!
by: nicver | last post by:
I am working on updating a Web site with a frameset. A page opens a pop-up window in which the user uploads pictures. Once the upload is done, I would like to refresh the content of the frame which...
by: Raj | last post by:
Hi All, I have a problem with trying to refresh the parent window from child window in order to update data in the parent window. The sequence of events are 1) I click a button in the parent...
by: JBD | last post by:
Hi, I have a button that fires the below sub routine. This works fine if the user clicks the button as they are supposed to, even if they click it repeatedly. However, if you click "refresh" on...
by: djc | last post by:
Is is possible to have one asp.net page from one browser window cause the 'refresh/repost' of a different page open in a seperate browser window? For example, page1 could have some data and some...
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? ...
by: mammen | last post by:
Hello, I'm writing trace log of various actions happening in my ASP.NET web application by opening a text file when the user logs in to the system and closing the file while the user logs out....
by: Jason S | last post by:
Hi, is there any way of getting my VB (6.0) program to automatically 'Refresh' an IE window that might be active (window status not applicable). It needs to be able to determine which active IE...
by: Piotr Nowak | last post by:
Hi, Say i have a server process which listens for some changes in database. When a change occurs i want to refresh my page in browser by notyfinig it. I do not want to refresh my page i.e....
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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,...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
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
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.