4

I'm trying to add a sidebar (experimental) to my extension.

I've enabled the "Experimental Extension APIs" in Chrome.

When I invoke:

chrome.experimental.sidebar.show(cTab);

method, (where cTab is current tab) I get an error:

Error during experimental.sidebar.show: This extension has no sidebar specified.

When I invoke:

chrome.experimental.sidebar.getState(cTab, function (state) { alert(state); });

I get "undefined" in the alert box.

I read the specs of chrome.experimental.sidebar and I have no clue how to add a sidebar to Chrome.

How can I specify a sidebar for my extension? Please help.

oers
  • 18,436
  • 13
  • 66
  • 75
pinus.acer
  • 962
  • 1
  • 9
  • 28

2 Answers2

4

First declare sidebar in your manifest:

{
    ...
    "sidebar": {},
    ...
}

Then to display sidebar.html in a current tab:

chrome.experimental.sidebar.show();
chrome.experimental.sidebar.expand();
chrome.experimental.sidebar.navigate({path: "sidebar.html"});

Here is example extension.

serg
  • 109,619
  • 77
  • 317
  • 330
2

This is no longer supported unfortunately. See:

How to create a sidebar(right-side) in google chrome?

Chrome.experimental.sidebar gone?

http://code.google.com/p/chromium/issues/detail?id=51084

Hopefully they'll add it back new and improved in a future release.

You'll need to use the DOM injection approach.

Community
  • 1
  • 1
bobics
  • 2,301
  • 2
  • 23
  • 25