Scale Chrome app window based on screen size

I have a Chrome app with a specific window size of 1280x720 (the app is loaded into remote content that is set to those sizes)

I am using the following code in background.js file (name in manifest):

chrome.app.window.create('index.html', {
  'bounds': {
    'width': 1280,
    'height': 720
  }
});

      

However, when running the app on a large TV (via ChromeBox) in kiosk mode, there is space on the right and bottom due to the app not scaling or scaling.

How can I get the app to fill the entire screen without changing the TV resolution (since this is only available for certain sets)?

I also tried adding "state": "fullscreen" to the background.js script (above) and it worked on my PC in the Chrome browser but didn't work on ChromeOS for some reason.

+3


source to share


3 answers


OK, so I got it using a combination of answers, so I'm posting the answer myself.

To make it work on ChromeBox and on my PC, I used the following in the backgorund.js file:



chrome.app.window.create('index.html', {
  'innerBounds': {
    'width': 1280,
    'height': 720,
    'minWidth': 1280,
    'minHeight': 720
  },
  'resizable':true,
  'state': 'fullscreen'
});

      

+2


source


I think this is what you need:

chrome.app.window.create('index.html', {
'bounds': {
'width': 1280,
'height': 720 },
 "resizable": true,
});

      



Otherwise I think you will need to use setMinimumSize

and place your height

both width

as minWidth

andminHeight

0


source


After creating the window, check the borders of the screen and resize it accordingly! Use the window API from the Chrome platform and maximize it based on dimensions.

0


source







All Articles