Take the 2-minute tour ×

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...


share|improve this question
if you are doing chrome extensions check out area51.stackexchange.com/proposals/10910/… –  Lizard Jul 8 '10 at 14:16
add comment

2 Answers

up vote 16 down vote accepted

This is not true for newer chrome apps.

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

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

share|improve this answer
This is the better, more current and more accurate answer, FYI –  Zack Shapiro Jul 6 '13 at 23:51
add comment

Well, in the extensions docs, it states in manifest, you would need to include "tabs" as its permission. Same way they explain the hello world application:

Manifest File:

  "name": "My Extension",
  "version": "1.0",
  "description": "Opens up a local webpage",
  "background_page": "bg.html",
  "browser_action": {
    "default_title": "",
    "default_icon": "icon_19.png"
  "permissions": [

Within the background page, you listen to the mouse click event on the browser action.

chrome.browserAction.onClicked.addListener(function(tab) {
  chrome.tabs.create({'url': chrome.extension.getURL('f.html')}, function(tab) {
    // Tab opened.

As you noticed above, you will see that I used the question you saw in the other post. Note, this isn't tested, but I believe it should work.

share|improve this answer
add comment

Your Answer


