views:

47

answers:

2

I was wondering, normally chrome extensions appear in their little area below their icon, but how would I make one that has it's own little space on a side of the browser, like FireBug lite does for chrome? Where it pushes the page up and docks at the bottom.
I have seen the sidebar in the 'experimental.sidebar' chrome api, but I don't want to use it because you have to start chrome with the command line switch --enable-experimental-extension-apis, and not many people would do that.

A: 

People usually use DOM manipulation. You can take a look at FireBugs source to see how they did the DOM. It is quite slow, but until the sidebars go out of experimental, that is the only way to do it right now.

Mohamed Mansour
Oh, I thought the javascript was run seperately from the javascript in the browser. Can you do stuff like that?
Exitus
Your exactly right, that is why Google Chrome Extension has a notion of content scripts that allow you to go directly into the DOM. Once you inject a content script to that page, you can do what you need. But that becomes slow (hence why sidebars will rise)
Mohamed Mansour
+1  A: 

Basically, until sidebars graduate from experimental status, you use a content script to set a big margin or padding on one side of body or html, inject a position: fixed element into the current page overlaid on that margin, and then draw to that.

Anything that needs to persist between pages gets stored by the extension and you re-create the pseudo-sidebar every time a page is loaded.

See the Firebug Lite or StumbleUpon extensions for examples.

ssokolow
Don't forget to mark one of us as "Best Answer" once you're convinced no more are forthcoming. People look at the percentage of accepted answers (the "accept rate" score) when deciding whether to answer your future questions.
ssokolow