prevent 'Uncaught beforeunload is not available in packaged apps' in Chrome