开发者

How could I make an extension that open a url when the icon is clicked?

There will be an icon in Chrome's extension bar, I'd like to ope开发者_C百科n a link in a new tab when the icon is clicked(instead of popup a popup page). How could I do that?


In your background page:

chrome.browserAction.onClicked.addListener(function() {
  chrome.tabs.create({url: "http://www.google.com"});
});

Google documentation for

  • chrome.browserAction.onClicked
  • chrome.tabs.create
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜