javascript - Is it possible to fire a modal when the user attempts to close the browser with AngularJS? -


like says title...

is possible fire modal when user attempts close browser angularjs? need show modal user fill out survey.

if possible, have u tuto? have trying next code in controller, displays confirm window.

$window.onbeforeunload = function (event) { var message = 'if leave page going lose unsaved changes, sure want leave?'; if (typeof event == 'undefined') { event = $window.event; }  return message; }; 

thanks ur help.

beforeunload browser standard. whatever return function message displays in confirmation dialog before closing window.

if you're using browser complies standard firefox, chrome, or ie, won't able hijack native behaviour. so, confirmation message should persuasive enough user want stay on site.


Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -