For my chrome extension I need to detect any click on any element on the page that might open a link and, let's say, show an alert box. There are plenty of websites where you might click on a video player or anywhere on the page and a new page will open (live streams etc.).
Links I've found useful :
How to detect if user it trying to open a link in a new tab?
How to detect Link clicks (text, images, etc) with Javascript?
So far the information I found presumes that I know which elements on the page will open the link. This javascript will be injected on the website and I do NOT know which click and where will open a new link. Is there a way to execute some code AFTER the user clicks such an element AND BEFORE the link is opened?