Merge pull request #1610 from dpalou/MOBILE-2728

MOBILE-2728 iframe: Allow navigating in online frames
main
Juan Leyva 2018-11-14 11:25:43 +01:00 committed by GitHub
commit d0b801dff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -317,8 +317,26 @@ export class CoreIframeUtilsProvider {
}
if (scheme && scheme != 'file' && scheme != 'filesystem') {
// Scheme suggests it's an external resource, open it in browser.
// Scheme suggests it's an external resource.
event.preventDefault();
const frameSrc = element.src || element.data,
frameScheme = this.urlUtils.getUrlScheme(frameSrc);
// If the frame is not local, check the target to identify how to treat the link.
if (frameScheme && frameScheme != 'file' && frameScheme != 'filesystem' &&
(!link.target || link.target == '_self')) {
// Load the link inside the frame itself.
if (element.tagName.toLowerCase() == 'object') {
element.setAttribute('data', link.href);
} else {
element.setAttribute('src', link.href);
}
return;
}
// The frame is local or the link needs to be opened in a new window. Open in browser.
if (!this.sitesProvider.isLoggedIn()) {
this.utils.openInBrowser(link.href);
} else {