Prepare target='_blank'

jh-changes
Shin'ya UEOKA 6 years ago committed by Shin'ya Ueoka
parent 728b0cb35f
commit 93f9e8219e
  1. 10
      src/content/usecases/FollowSlaveUseCase.ts

@ -63,16 +63,16 @@ export default class FollowSlaveUseCase {
if (hint instanceof LinkHint) { if (hint instanceof LinkHint) {
let url = hint.getLink(); let url = hint.getLink();
// ignore taget='_blank' let openNewTab = newTab;
if (!newTab && hint.getLinkTarget() === '_blank') { // Open link by background script in order to prevent a popup block
hint.click(); if (hint.getLinkTarget() === '_blank') {
return; openNewTab = true;
} }
// eslint-disable-next-line no-script-url // eslint-disable-next-line no-script-url
if (!url || url === '#' || url.toLowerCase().startsWith('javascript:')) { if (!url || url === '#' || url.toLowerCase().startsWith('javascript:')) {
return; return;
} }
await this.tabsClient.openUrl(url, newTab, background); await this.tabsClient.openUrl(url, openNewTab, background);
} else if (hint instanceof InputHint) { } else if (hint instanceof InputHint) {
hint.activate(); hint.activate();
} }