3

According to that API definition: https://developer.chrome.com/extensions/windows.html#type-Window window has a (new) property called 'alwaysOnTop' (As I understand, it means that even if the user clicked somewhere else on the screen, this window sticks to the front, like 'chat for google' does).

I can't get how to create a window which has this property (chrome.window.create() doesn't contain it among the parameters it gets). I've tried several ways, like using the function that create gets and other options, but none worked. The console messages didn't help me to figure out what the right way is.

Could someone please post a short example that demonstrate a creation of such a window ?

Subway
  • 5,286
  • 11
  • 48
  • 59

1 Answers1

6

alwaysOnTop is not a valid argument for chrome.windows.create.

Indeed, it is mentioned in the documentation, but listened under the Window type, which describes an object which is passed to many of the chrome.windows API method callbacks.

Compare chrome.windows.create#createData and the Window type's properties.

Rob W
  • 341,306
  • 83
  • 791
  • 678
  • Thanks Rob. I've noticed that, but the Window object is mentioned [here](http://developer.chrome.com/extensions/windows.html#property-create-createData) as an optional parameter to the callback passed to create: "callback ( optional function ) Parameters window ( optional Window ) **Contains details about the created window**." So I thought this is the say to obtain this property to the created window. Anyhow, is there no way for obtaining this ? – Subway Nov 27 '12 at 07:43
  • @Rapher No. What you're quoting is the "read-only" information received by the callback of `chrome.windows.create`. You cannot set this property yourself (yet). – Rob W Nov 27 '12 at 09:13
  • 1
    So, why does this property exist at all, if there is no way to actually set it to a window ? – Subway Nov 27 '12 at 10:33
  • @Rapher Use `type: "panel"` when you create the window using `chrome.windows.create`. This will create a window which is always on top *provided that* panels are enabled, via `chrome://flags/` or using the `--enable-panels` flag. – Rob W Nov 27 '12 at 16:28
  • Thank you. Before I've posted this question, I searched a lot to find where this flag (--enable-panels) hides itself :). I can't find it, would you mind to point me to the right place ? – Subway Nov 27 '12 at 17:26
  • @Rapher Visit `chrome://flags/` and search for "Enable Panels" **OR** change your Chrome shortcut and append the flag, eg `chrome.exe --enable-panels`. The first option is the easiest (and persistent) option, the second one only works if you launch Chrome using that shortcut. – Rob W Nov 27 '12 at 17:28
  • So both are not ideal if I intend my extension to be used by other people. Too bad :( Oh, one day panels will be available without those flags, yay! :) @Rob, Many thanks. +1 for the back and forth conversation. – Subway Nov 27 '12 at 17:41
  • This option _is_ available for **Chrome Apps** (`chrome.app.window.create`). See http://stackoverflow.com/questions/19960076/chrome-packaged-app-alway-on-top-window for more details. – Paulo Aug 04 '14 at 15:01