fix(clickTtHttpPageRoutes): improve event handling in proxy navigation script

- Added a check to prevent default actions if the event has already been prevented, ensuring better control over link navigation.
- Changed the event listener from capturing to bubbling phase to enhance compatibility with other event handlers in the document.
This commit is contained in:
Torsten Schulz (local)
2026-03-10 22:57:06 +01:00
parent 59d7c3559c
commit 79ce79db8c

View File

@@ -205,12 +205,12 @@ function injectProxyNavigationScript(html, proxyBaseUrl, pageBaseUrl, sid) {
document.addEventListener('click', function (event) {
const anchor = event.target && event.target.closest ? event.target.closest('a[href]') : null;
if (!anchor) return;
if (event.defaultPrevented) return;
const targetUrl = normalizeUrl(anchor.getAttribute('href'), PAGE_BASE_URL);
if (!targetUrl || !shouldProxyUrl(targetUrl)) return;
event.preventDefault();
event.stopPropagation();
navigateViaProxy(targetUrl);
}, true);
}, false);
document.addEventListener('submit', function (event) {
const form = event.target;