473,666 Members | 2,237 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 1669
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.javas cript 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="myRem inder();">

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="myRem inder();">

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="myRem inder();">

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.javas cript 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
4365
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 the enlarged version of said thumbnail. This works fine on all current browsers I've tested. However, in case I do not close the popup but click on another thumbnail instead, only IE replaces the enlarged pic by the new one, Firebird and Opera...
38
5051
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 out what i'm doing wrong, and so far it seems i'm doing it the right way. Here's my code...any suggestions would be appreciated. <script language="javascript"> <!-- window.open("256fx/index.htm", "", "height=400, width=600"); //-->
4
34862
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 as a new window. The original window plus the Modally opened Pop remain in a separate window. What I want to do is close the popup and return to the original window with its view state maintained. The control use to fire the popup window...
2
1339
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 enters childnode information. the pop up has a save button and when the user clicks save, the data gets saved in DB. Popup also has a close button, clicking which closes the screen.. My Problem: When i close the popup, how can i refresh the tree...
1
11568
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 http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
6936
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. After entering these two items the user can either hit the enter key or press the submit button. The popup window will close and then those two text boxes in the original webpage will be filled in automatically. I would like to have the two...
3
2161
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, and the second is that it closes the popup window when you click outside of it. It is a script I have found on the internet, since I have no experience in javascript coding.
11
7333
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.7.12 (linux kubuntu). It does work with konqueror. It seems to work with firefox on windows but not with IE (not completly sure though).
1
3219
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 button". when "submit" button pressed, call the "servlet" in this popup window and then close the "popup" window. <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var X = 200; // change the # at the left for a fixed X co-ordinate to accommodate...
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6191
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 presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.