Google Chrome Extensions - Open New Tab when clicking a toolbar icon

Alon Gubkin picture Alon Gubkin · Jul 6, 2010 · Viewed 81.3k times · Source

How can I create an extension for Chrome that adds an icon to the toolbar, and when you click it, it opens a new tab with some local web page (for example: f.html)?

I saw this question, but it doesn't really explains what should I add in the manifest file...

Answer

Abhishek Mehta picture Abhishek Mehta · Feb 4, 2013

This is not true for newer chrome apps.

Newer chrome apps having manifest_version: 2 requires the tabs be opened as:


chrome.browserAction.onClicked.addListener(function(activeTab)
{
    var newURL = "http://www.youtube.com/watch?v=oHg5SJYRHA0";
    chrome.tabs.create({ url: newURL });
});