pinus.acer
pinus.acer

Reputation: 972

How can I specify a sidebar in Chrome extension?

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.

Upvotes: 4

Views: 2310

Answers (2)

bobics
bobics

Reputation: 2321

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.

Upvotes: 2

serg
serg

Reputation: 111325

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.

Upvotes: 4

Related Questions