3

While developing a chrome extension, when the extension shows as a new browser window all the browser toolbars (back, refresh, bookmarks, etc.) are visible. I've seen extensions that open with this method, but don't have their toolbars. Does anyone know how to remove the browser toolbars and show a stripped down window?

For an example, check out the Hootsuite extension.

Corey
  • 166
  • 3
  • 14
  • Related: [popup window in Chrome extension](http://stackoverflow.com/questions/10340481/popup-window-in-chrome-extension) (not a duplicate, because the linked question has an additional requirement) – Rob W Sep 05 '12 at 16:11

1 Answers1

7
  1. Chrome API: chrome.windows.create({type:'popup', url:'...'}); (see documentation for more options, such as width, height, etc.).
    To use this API, you need to specify the "tabs" permission in the manifest file.
  2. The Chrome extension API is a superset of JavaScript. In JavaScript, window.open can be used to create a window. In a Chrome extension, this is also possible. Hootsuite also uses this method, as seen in the source code:

    window.open(address, "hootlet",'scrollbars=0,toolbar=0,location=0,resizable=0,status=0,width=550,height=280');
    
Rob W
  • 341,306
  • 83
  • 791
  • 678
  • I don't see anything in the Chrome API documentation around a toolbar parameter for chrome.windows.create. – Corey Sep 05 '12 at 17:09
  • @CoreyC The code above create a window with only a border. The `popup` type is very minimalistic. – Rob W Sep 05 '12 at 17:17
  • I should have specified that, due to functionality in the extension, I am using the `normal` type that by default, opens a full browser window. – Corey Sep 05 '12 at 20:48
  • @CoreyC And I'm suggesting to use the `popup` type if you want a "popup" layout. There is no way to remove toolbars, etc. from an existing window. The only way to get a window without toolbars, etc. is to open a new one - either using the Chrome API, or using `window.open`. I repeat: If you want to get a popup window, use the `popup` type, *not* the `normal` type. – Rob W Sep 05 '12 at 20:55