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

Browser Close Problem

Dear All,

I have a Main Asp.Net page . In that Page I have a Tab Strip which has
SIX tabs each representing a different web Forms.So that when a user
clicks different tab he can navigate between different forms.In my Main
Page I have written a javascript code

function ConfirmClose() {

confirm("Are you Sure You Want to Close This Main Window?") ;

}

and in the body tag of Main form I have written <body onbeforeunload
="ConfirmClose()" >
Now this code is only for the Main Form which has a Tab Strip of SIX
different forms. Now the problem is When the Main Page is loaded
and I click X button of the browser It displays the message
("Are you Sure You Want to Close This Main Window?") which is
fine, but when I navigate to some other Form which is within the
MAIN FORM by pressing the Tab button the above message again
pops up.and it keeps poping up as I navigate through the six forms.
which I dont want. I only want this message to appear when I press
X Button of Main Browser window .

Any help much appreciated.

cheers,
Sunil Sabir
Nov 18 '05 #1
2 1645
See the documentation for the onclose event (I believe, check aslo brower
support).

onbeforeunlaod is when the current document uis unloaded. This is the case
each time you request a new page from the server...

Patrice.

--

"Sunil Sabir" <Su********@discussions.microsoft.com> a écrit dans le message
de news:E4**********************************@microsof t.com...
Dear All,

I have a Main Asp.Net page . In that Page I have a Tab Strip which has
SIX tabs each representing a different web Forms.So that when a user
clicks different tab he can navigate between different forms.In my Main
Page I have written a javascript code

function ConfirmClose() {

confirm("Are you Sure You Want to Close This Main Window?") ;

}

and in the body tag of Main form I have written <body onbeforeunload
="ConfirmClose()" >
Now this code is only for the Main Form which has a Tab Strip of SIX
different forms. Now the problem is When the Main Page is loaded
and I click X button of the browser It displays the message
("Are you Sure You Want to Close This Main Window?") which is
fine, but when I navigate to some other Form which is within the
MAIN FORM by pressing the Tab button the above message again
pops up.and it keeps poping up as I navigate through the six forms.
which I dont want. I only want this message to appear when I press
X Button of Main Browser window .

Any help much appreciated.

cheers,
Sunil Sabir

Nov 18 '05 #2
that is correct. the event fire whenever a page is unloaded, which will
happen with any navigation. there is no browser event tied to actual browser
close. you can host your site in a frameset that detects the close, which
would be closer to want you want.

-- bruce (sqlwork.com)
"Sunil Sabir" <Su********@discussions.microsoft.com> wrote in message
news:E4**********************************@microsof t.com...
Dear All,

I have a Main Asp.Net page . In that Page I have a Tab Strip which has
SIX tabs each representing a different web Forms.So that when a user
clicks different tab he can navigate between different forms.In my Main
Page I have written a javascript code

function ConfirmClose() {

confirm("Are you Sure You Want to Close This Main Window?") ;

}

and in the body tag of Main form I have written <body onbeforeunload
="ConfirmClose()" >
Now this code is only for the Main Form which has a Tab Strip of SIX
different forms. Now the problem is When the Main Page is loaded
and I click X button of the browser It displays the message
("Are you Sure You Want to Close This Main Window?") which is
fine, but when I navigate to some other Form which is within the
MAIN FORM by pressing the Tab button the above message again
pops up.and it keeps poping up as I navigate through the six forms.
which I dont want. I only want this message to appear when I press
X Button of Main Browser window .

Any help much appreciated.

cheers,
Sunil Sabir

Nov 18 '05 #3

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

Similar topics

2
by: ho0c1355 | last post by:
Hi, I was wondering anyone can help me? I am looking for a javascript that can do such a thing? If the Mouse and keyboard sit and do nothing for 5 to 10 minutes. The Internet Browser will close...
34
by: Charles Douglas Wehner | last post by:
This is a serious question - but probably one that has been asked many times before. Go to http://wehner.org It has FRAMES. Select ADDISON. The main page (to the right of the buttons) shows...
1
by: Matt | last post by:
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...
3
by: Gin Lye | last post by:
Does any one know to close the web browser automatically after logging off Your help will be appreciated gin lye
3
by: Ben | last post by:
Hi, I'm sending out a session cookie. That is a cookie that has no expiration date. When I surf through the site, no problems, but if I close the browser and open it back up, the cookie is still...
6
by: hemant.singh | last post by:
Hi all, I am trying to get a way by which I'll know exactly when user goes out of my site by clicking on close button in browser, So that w/e user click close button in browser, I can send a...
1
by: SwamyKarthik | last post by:
I am building an MS Access application that has an embedded web browser in a form. The form is linked to a table and the browser navigates to the address in the table. I have used the activeX...
0
by: rehanrana | last post by:
I built application in VB6, my application appear in system tray, when I double click on icon of my application, it run screen saver, my screen saver shows images and news. Screen saver...
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: 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?
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.