Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

target='_blank' link #94

Merged
merged 1 commit into from
Oct 25, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
allow to open target='_blank' link
ueokande committed Oct 25, 2017
commit fda4c95b8964f9d83bd810790cec3c3cd3790e92
7 changes: 4 additions & 3 deletions src/content/components/common/follow.js
Original file line number Diff line number Diff line change
@@ -54,7 +54,8 @@ export default class Follow {
}

openLink(element) {
if (!this.newTab) {
// Browser prevent new tab by link with target='_blank'
if (!this.newTab && element.getAttribute('target') !== '_blank') {
element.click();
return;
}
@@ -68,7 +69,7 @@ export default class Follow {
return browser.runtime.sendMessage({
type: messages.OPEN_URL,
url: element.href,
newTab: this.newTab,
newTab: true,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change allows to open a new tab even when newTab is false.
I think it's better to prioritize user's newTab option.

});
}

@@ -117,7 +118,7 @@ export default class Follow {
let element = hint.target;
switch (element.tagName.toLowerCase()) {
case 'a':
return this.openLink(element, this.newTab);
return this.openLink(element);
case 'input':
switch (element.type) {
case 'file':