How to ensure that all onclick events on clicked domnode got executed before the page navigates to another page

We are working on an Open Source Chrome extension: Digital Assistant Client

Product Demo:

Part 1: https://www.youtube.com/watch?v=Iz2WgKY0fhc

Part 2: https://www.youtube.com/watch?v=i0_MNfBnYfM

We are having trouble in getting our onclick event handler executed when the page is navigated to another page.

I want to invoke all the onclick event handlers attached to a domnode that the user has clicked before the page gets navigated to another page so that our functionality gets executed. The solution should work for any framework that cancels the bubbling of the onclick event handlers.

There are some questions already raised by some people as given below

  1. How to ensure that a function is executed completely, before navigating to another page?
  2. How to execute onclick before navigating to a different page?

Yeah, browsers these days are way too fast :smiley:.
Maybe you can react already on mouseup event which is fired before click.

Or maybe you can use WebWorker that will execute it in background (I’m not sure though, I haven’t used it yet):