MOBILE-3701 iframe: Ignore links with href=#
parent
efe8b116d3
commit
51906f275c
|
@ -187,7 +187,11 @@
|
||||||
context: 'iframe',
|
context: 'iframe',
|
||||||
action: 'link_clicked',
|
action: 'link_clicked',
|
||||||
frameUrl: location.href,
|
frameUrl: location.href,
|
||||||
link: {href: link.href, target: link.target},
|
link: {
|
||||||
|
href: link.href,
|
||||||
|
target: link.target,
|
||||||
|
originalHref: link.getAttribute('href'),
|
||||||
|
},
|
||||||
}, '*');
|
}, '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -427,13 +427,13 @@ export class CoreIframeUtilsProvider {
|
||||||
/**
|
/**
|
||||||
* A link inside a frame was clicked.
|
* A link inside a frame was clicked.
|
||||||
*
|
*
|
||||||
* @param link Data of the link clicked.
|
* @param link Link clicked, or data of the link clicked.
|
||||||
* @param element Frame element.
|
* @param element Frame element.
|
||||||
* @param event Click event.
|
* @param event Click event.
|
||||||
* @return Promise resolved when done.
|
* @return Promise resolved when done.
|
||||||
*/
|
*/
|
||||||
protected async linkClicked(
|
protected async linkClicked(
|
||||||
link: {href: string; target?: string},
|
link: CoreIframeHTMLAnchorElement | {href: string; target?: string; originalHref?: string},
|
||||||
element?: HTMLFrameElement | HTMLObjectElement,
|
element?: HTMLFrameElement | HTMLObjectElement,
|
||||||
event?: Event,
|
event?: Event,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -443,7 +443,8 @@ export class CoreIframeUtilsProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
const urlParts = CoreUrl.parse(link.href);
|
const urlParts = CoreUrl.parse(link.href);
|
||||||
if (!link.href || !urlParts || (urlParts.protocol && urlParts.protocol == 'javascript')) {
|
const originalHref = 'getAttribute' in link ? link.getAttribute('href') : link.originalHref;
|
||||||
|
if (!link.href || !originalHref || originalHref == '#' || !urlParts || urlParts.protocol == 'javascript') {
|
||||||
// Links with no URL and Javascript links are ignored.
|
// Links with no URL and Javascript links are ignored.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue