473,508 Members | 2,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

popup if user wants to close window or enter another url

hi all how can u create a conditional alert when the user tries to
close the window or enters another url into the browser? i want to
remind them to save changes.

Aug 5 '06 #1
5 1664
libsfan01 said the following on 8/5/2006 7:11 AM:
hi all how can u create a conditional alert when the user tries to
close the window or enters another url into the browser? i want to
remind them to save changes.
Let them suffer a few times of having to re-enter things and they will
soon start making sure they save it. As for what you think you want to
do, you can't reliably do it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 5 '06 #2
It is possible but I strictly recommend you to not use this feature.
You can simply
atach alert function to onunload event handler on BODY tag for example.

<script type="text/javascript">
function myReminder(){
alert("Do you save the changes?");
}
</script>
</head>
<body onunload="myReminder();">

But it is very irritatingli for some users and not good decision about
crossbrowser compatibility.

libsfan01 написа:
hi all how can u create a conditional alert when the user tries to
close the window or enters another url into the browser? i want to
remind them to save changes.
Aug 5 '06 #3
Georgi Naumov wrote:
It is possible but I strictly recommend you to not use this feature.
You can simply
atach alert function to onunload event handler on BODY tag for example.

<script type="text/javascript">
function myReminder(){
alert("Do you save the changes?");
}
</script>
</head>
<body onunload="myReminder();">

But it is very irritatingli for some users and not good decision about
crossbrowser compatibility.
and also very annoying when it gets used for asking you if you want to
bookmark (or set as home pg on browser) the url you're leaving... in
this case I think it would be more justified, maybe do it so users get
reminded only the first few times they visit (can this be done just
client-side? don't remember now...)
>
libsfan01 написа:
>hi all how can u create a conditional alert when the user tries to
close the window or enters another url into the browser? i want to
remind them to save changes.
Aug 5 '06 #4
Yes this can be done just client-side. If you want you can use cookie
for store
how many times the user was been ot this web page. Otherwise this way
don't work if the user restrict cookies.
maya написа:
Georgi Naumov wrote:
It is possible but I strictly recommend you to not use this feature.
You can simply
atach alert function to onunload event handler on BODY tag for example.

<script type="text/javascript">
function myReminder(){
alert("Do you save the changes?");
}
</script>
</head>
<body onunload="myReminder();">

But it is very irritatingli for some users and not good decision about
crossbrowser compatibility.

and also very annoying when it gets used for asking you if you want to
bookmark (or set as home pg on browser) the url you're leaving... in
this case I think it would be more justified, maybe do it so users get
reminded only the first few times they visit (can this be done just
client-side? don't remember now...)

libsfan01 написа:
hi all how can u create a conditional alert when the user tries to
close the window or enters another url into the browser? i want to
remind them to save changes.
Aug 5 '06 #5
Georgi Naumov said the following on 8/5/2006 6:01 PM:
Yes this can be done just client-side.
Prove it.
If you want you can use cookie for store how many times
the user was been ot this web page.
Unreliable.
Otherwise this way don't work if the user restrict cookies.
Or the user deletes the cookies daily.
Or the user has an anti-spyware program that removes them daily.
Or the cookies aren't reliable.
Or client side scripting is disabled.
Or the user is blind.
Or.....

You might be learning, time will tell.

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

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

Similar topics

2
4351
by: Moon | last post by:
Seems I still haven't got the hang of all those window generating code in Javascript. I've got a page with about 15 photo thumbnails. When you click on a thumbnail a new window pops up which shows...
38
5002
by: Shaun McKinnon | last post by:
HI...Here's my problem...I have a popup window that loads when i want it to, but it's not sized properly. I've set the size, but it doesn't seem to work. I've been on 8 different websites to find...
4
34831
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
2
1329
by: sri | last post by:
hi All: This is the situaton.. I have a treeview with nodes in an aspx page. The node data is coming from DB. when i select a node and click add button, a pop up screen is ahown where the user...
1
11537
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
6918
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
3
2146
by: EnjoyNews | last post by:
I have a popup problem. I have a script that generates a popup for image viewing. It has 2 function, and the first is that it automaticly generates the popup window to the size of the image,...
11
7320
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
1
3195
by: dittu | last post by:
How to close the popup window when submitting the form? I have a sample.jsp. In that page one button is there. when button pressed, open popup window contains one "text box" and one " submit...
0
7225
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
7123
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...
0
7326
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
7383
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...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3194
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1557
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.