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

Custom onbeforeunload traitment

Hi all,

I just want to define my own confirm box to ask before a changing page.

For now, i'm doing this :

---------------------------------------
function myFunc()
{
return "Leave or Stay ?";
}
<body onbeforeunload="return myFunc()">
---------------------------------------

And this gives me a confirm box with "OK" button and "Cancel" button.

I want to keep this functionnality, but i'd like to desing my own
confirm box. I first want to change the caption of the button (for
example "Leave" and "Stay"), and why not, having a beautiful confirm
box with layer and div ...

Is it possible ? and how ?

Thanks a lot for you help

Nicolas H.

Aug 24 '05 #1
3 4092
I don't find any Q/R or example to show me if it's possible or not :(

Aug 26 '05 #2
ASM
ni*************@motorola.com wrote:
I don't find any Q/R or example to show me if it's possible or not :(


My IE (5.2 Mac) doesn't know 'onbeforeunload'
My FF display a box (in Fr)
- telling me I'm leaving a page
- adding something like :
Do you really want to leave ? if yes hit [OK]
else hit [Cancel]
- with your 'Leave or Stay' in middle
You can't modify alert or confirm boxes (except with IE Win, I think)

perhaps :
You may have a hidden, absolute div pretty styled as you like
and on leave event make it visible, trying to move it in center window
--
Stephane Moriaux et son [moins] vieux Mac
Aug 26 '05 #3
ASM
ni*************@motorola.com wrote:
Hi all,

I just want to define my own confirm box to ask before a changing page.
snip
why not, having a beautiful confirm
box with layer and div ...


http://www.theopensourcery.com/jspopwin1.htm

--
Stephane Moriaux et son [moins] vieux Mac
Aug 26 '05 #4

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

Similar topics

4
by: lltaylor | last post by:
Hello, Currently I use an onbeforeunload method, to do call various tidy up methods when a user exits my web application - however I now need to add additional support, for users migrating to...
6
by: jennyw | last post by:
Hi, I'd like to use onbeforeunload to submit a form before leaving a page. This works in Firefox and IE. Safari, however, blithely ignores this. Does anyone know of a workaround for Safari? Or...
4
by: sowencheung | last post by:
the bug of onbeforeunload is so obvious! in IE 6 it will popup twice "sometimes" I am using the following code window.onbeforeunload = null; window.onbeforeunload = confirmExit; var...
8
by: drewmania001 | last post by:
im currently using the following to prompt the user before navigating away from the page // add an unload event window.onbeforeunload = bunload; // function to prompt user function...
1
by: David | last post by:
I am using a process to warn users when they leave a page that there have been changes made. I took the example directly from Microsoft example I found in searching for help on the event...
5
by: allan.young | last post by:
Hi, When in gmail I'm composing a new email message and I bit the browser back button, I get a dialog that says "Your message has not been sent. Discard your message?" But if instead of...
1
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
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.