Google Chrome Extension

How to open a link in a new tab in the HTML extension.

eg.

clicks on the icon

sees a google chrome window that has window.html in it

inside there are two links, one link to open the link in a new tab, the other on the original tab.

I used window.location, does not work like that.

+3
source share
2 answers

I don’t know why this question has two upvotes, but you can try using the target attribute for the anchor elements anyway .

<a target="_blank" src="http://myFancyUrl">This is a link to a new tab</a>

However, it will not open in a new tab if the user has not configured the navigator in this way (usually does).

+2

google chrome, javascript (, , , google chrome).

chrome.tabs.create({url:"http://somewhere", selected:true});

.

: http://code.google.com/chrome/extensions/tabs.html

+4

Source: https://habr.com/ru/post/1744383/


All Articles