question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

beforeunload handler causes app to close on refresh from DevTools

See original GitHub issue

I tracked it down to this: bc7b401

window.addEventListener('beforeunload', (e) => {
    // See http://electron.atom.io/docs/api/browser-window/#event-close
    e.returnValue = false;
    this.app.close();
});

We should find a better way to do this.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martpiecommented, Nov 19, 2016

yep, it would call BrowserWindow.hide() and not minimize() though.

If the option is not checked in the admin, it will close the app.

You’ll need to edit some file like

  • js/actions/AppActions.js
  • js/main-process/tray.js
0reactions
YurySolovyovcommented, Nov 30, 2016

I think this is broken again/still. Dev flow like fix->refresh->check does not work for me. It either errors or minimizes the app.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Window: beforeunload event - Web APIs | MDN
The beforeunload event is fired when the window, the document and its resources are about to be unloaded. The document is still visible...
Read more >
unload And beforeunload Events And How To Debug Them ...
The answer is no. There are some types of actions that by spec are not allowed to be executed within a beforeunload /...
Read more >
beforeunload and unload do not fire when closing a window ...
When I navigate a BrowserView to a page that has beforeunload and unload handlers, I expect that closing the window will cause them...
Read more >
Is it possible to detect what action causes page reload?
Try opening the Network panel, enabling Preserve log (which saves the network activity log between page loads) and then recreating the behavior.
Read more >
window.onbeforeunload and Cypress - Gleb Bahmutov
The application · The strange behavior · Chrome browser · Use the DevTools console · Solution 1: remove window.onbeforeunload · Solution 2: prevent ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found