From 93f9e8219eac89d00ec710b646d18e47322d3e23 Mon Sep 17 00:00:00 2001 From: Shin'ya UEOKA Date: Wed, 22 May 2019 07:36:07 +0000 Subject: Prepare target='_blank' --- src/content/usecases/FollowSlaveUseCase.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/content') diff --git a/src/content/usecases/FollowSlaveUseCase.ts b/src/content/usecases/FollowSlaveUseCase.ts index a2cc80e..2bd16ee 100644 --- a/src/content/usecases/FollowSlaveUseCase.ts +++ b/src/content/usecases/FollowSlaveUseCase.ts @@ -63,16 +63,16 @@ export default class FollowSlaveUseCase { if (hint instanceof LinkHint) { let url = hint.getLink(); - // ignore taget='_blank' - if (!newTab && hint.getLinkTarget() === '_blank') { - hint.click(); - return; + let openNewTab = newTab; + // Open link by background script in order to prevent a popup block + if (hint.getLinkTarget() === '_blank') { + openNewTab = true; } // eslint-disable-next-line no-script-url if (!url || url === '#' || url.toLowerCase().startsWith('javascript:')) { return; } - await this.tabsClient.openUrl(url, newTab, background); + await this.tabsClient.openUrl(url, openNewTab, background); } else if (hint instanceof InputHint) { hint.activate(); } -- cgit v1.2.3