diff --git a/app/src/static/preload.js b/app/src/static/preload.js index 27e704b..9cacbf6 100644 --- a/app/src/static/preload.js +++ b/app/src/static/preload.js @@ -17,6 +17,12 @@ document.addEventListener('DOMContentLoaded', () => { window.addEventListener('contextmenu', event => { event.preventDefault(); const targetElement = event.srcElement; + + // the clicked element is the deepest in the DOM, and may not be the bearing the href + // for example, Google + while (!targetElement.href && targetElement.parentElement) { + targetElement = targetElement.parentElement; + } const targetHref = targetElement.href; if (!targetHref) {