Controlling Navigation Acknowledgment Window Use JavaScript

Often a user misuses a rich Internet application and tries to use the browser's back button. Such errors can be devastating to modified but unsaved information, as in a Flash or Flex application.

The easiest way to notify the user of confirmation before leaving the page (see below). However, I have a client who strongly wants the Confirm Navigation window that appears to appear on the SIDE screen, unlike the center, which by default it runs in all major browsers.

In the window in question, different things depend on your browser, but how can I influence the position in which it appears?

Just make sure in which window I refer:

If you use IE, the text of the window will say: "Are you sure you want to go from this page?" If you use Google Chrome, the title bar will say “Confirm navigation”.

Specifically: 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>

How can I make the confirmation window pop up in a place other than the very center of the browser window, for example, on the left?

+3
source share
2 answers

How can I make the confirmation window pop up in a place other than the very center of the browser window, for example, on the left?

You cannot influence this. It is completely under the control of the browser, for example, native dialogs confirmand prompt.

, onbeforeupload - , JavaScript.

+4

:

return('Please Save Your Work Before Leaving The Page.\n\nAre You Sure?');

. :

return 'Please Save Your Work Before Leaving The Page.\n\nAre You Sure?';
-2

Source: https://habr.com/ru/post/1764940/


All Articles