2
2
mirror of https://github.com/Llewellynvdm/nativefier.git synced 2024-11-11 15:51:06 +00:00

Fix #621 - Always open external links externally (#622)

The tab feature introduced by #579 included a change that checks the `disposition` parameter and conditionally creates tabs, and that check was placed prior to the check to see if the URL is internal. This change moves the `linkIsInternal()` check earlier so that external links are always opened externally, regardless of disposition.
This commit is contained in:
David Kramer 2018-05-27 11:02:24 -07:00 committed by Ronan Jouchet
parent 587d615085
commit 1afc480923

View File

@ -217,22 +217,17 @@ function createMainWindow(inpOptions, onAppQuit, setDockBadge) {
event.newGuest = newGuest; event.newGuest = newGuest;
} }
}; };
if (nativeTabsSupported()) {
if (disposition === 'background-tab') {
const newTab = createNewTab(urlToGo, false);
preventDefault(newTab);
return;
} else if (disposition === 'foreground-tab') {
const newTab = createNewTab(urlToGo, true);
preventDefault(newTab);
return;
}
}
if (!linkIsInternal(options.targetUrl, urlToGo, options.internalUrls)) { if (!linkIsInternal(options.targetUrl, urlToGo, options.internalUrls)) {
shell.openExternal(urlToGo); shell.openExternal(urlToGo);
preventDefault(); preventDefault();
// eslint-disable-next-line no-useless-return } else if (nativeTabsSupported()) {
return; if (disposition === 'background-tab') {
const newTab = createNewTab(urlToGo, false);
preventDefault(newTab);
} else if (disposition === 'foreground-tab') {
const newTab = createNewTab(urlToGo, true);
preventDefault(newTab);
}
} }
}; };