2

Is it possible to show a designed modal or element in the browser window when a user tries to close the window, instead of a browser alert box?

I tried playing with window.onbeforeload = function(){...} but that was only for an alert box it seemed.

A second question is, can this browser alert box carry 3 questions and at least 2 of those questions have links to another location?

ntgCleaner
  • 5,865
  • 9
  • 48
  • 86
  • possible duplicate http://stackoverflow.com/questions/1631959/browser-window-close-event – jing3142 Feb 21 '14 at 17:57
  • No, this question asks if you can design the window that shows the alert – ntgCleaner Feb 21 '14 at 18:02
  • As far as I know, there is no way to style browser alert boxes or add functionality to them. – Lucas Penney Feb 21 '14 at 18:59
  • @LucasPenney Is there a way to style a box before the browser closes? I technically just want to style a div that shows when the browser closes, instead of an alert box. Maybe even show a div BEFORE the browser alert box? (bad UI, but asking if it's possible) – ntgCleaner Feb 21 '14 at 19:03

1 Answers1

1

You could probably do something in the HTML before firing an alert, but you cannot do it in lieu of that.

And no, you can't add more options to alert/prompt dialogs.

Collin Grady
  • 2,226
  • 1
  • 14
  • 14
  • Ok, so I could show a container before the alert, then the alert will show? Would I be able to disable the alert if they cancel the action? – ntgCleaner Feb 21 '14 at 21:44