views:

66

answers:

1

Often a user will misuse a Rich Internet Application, and attempt to use the browser's Back Button. Such mistakes can be disruptive to changed but unsaved information, as in a Flash or Flex application.

It is a simple matter to alert the user for confirmation before leaving the page (see below). However, I have a client who strongly desires the resulting "Confirm Navigation" window to appear on the SIDE of the screen, as opposed to the center, which by default, it currently does in all major browsers.

The window in question says different things depending on your browser, but how could I go about influencing the position at which it pops up?

Just so you are certain as to which window I'm referring:

If you use I.E. the window text will say: "Are you sure you want to navigate away from this page?" If you use Google Chrome, the window title will say "Confirm Navigation".

To wit: Something similar to the following Javascript:

<HTML>
<HEAD>
  <script language="javascript"> 
 function SaveYourWork() {
   return('Please Save Your Work Before Leaving The Page.\n\nAre You Sure?');
 }
    window.onbeforeunload=SaveYourWork;
  </script>
</HEAD>
<BODY>
  <h2>Some R.I.A.</h2>
</BODY>
</HTML>

For this example you may visit: http://www.metamag.net/AreYouSure.html

How can I make the confirmation window pop up in a location other than the very center of the browser window, such as the far left instead?

+2  A: 

How can I make the confirmation window pop up in a location other than the very center of the browser window, such as the far left instead?

You won't be able to influence this. It is entirely under the control of the browser, like the native confirm and prompt dialogs.

I can also not think of a workaround, because onbeforeupload is an event that can't be influenced or replicated with normal JavaScript methods.

Pekka
Indeed. The `beforeunload` capability is deliberately very limited, to try to prevent scripts from tricking the user.
bobince