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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user