Owen
Owen

Reputation: 47

How do you make a Chrome App automatically launch in a maximized window?

I am making a chrome application and I am wondering how I would make the program automatically run in a maximized window. The manifest.json defaulted to 800x600 but I want it to fill whatever the largest dimensions are. I saw on one of Google's developer pages that you can use maxWidth and maxHeight for this, but I don't know where in the manifest.json to potentially put those values. Thanks!

Upvotes: 0

Views: 409

Answers (1)

Xan
Xan

Reputation: 77523

This state is not controlled by the manifest.

See the very first tutorial on apps: window parameters are set in your background script when you create the window with chrome.app.window.create.

So, let's go see the documentation for chrome.app.window.create().

It takes a parameter of type CreateWindowOptions. Let's see its documentation.

(optional) state

enum of "normal", "fullscreen", "maximized", or "minimized"

The initial state of the window, allowing it to be created already fullscreen, maximized, or minimized. Defaults to 'normal'.

For example:

chrome.app.window.create('index.html', { 
  id: 'mainWindow',
  bounds: {width: 800, height: 600},
  state: 'maximized'
}); 

Upvotes: 1

Related Questions