Entertainment at it's peak. The news is by your side.

Managing Several Displays with the Multi-Screen Window Placement API


Score information about connected displays and position home windows relative to those displays.


The Multi-Show Window Placement API is half of the
capabilities venture and is at the moment in
development. This submit will seemingly be up as a lot as now as the implementation progresses.

The Multi-Show Window Placement API enables you to enumerate the
displays connected to your machine and to space home windows on command monitors.

Steered use circumstances

Examples of web sites that will use this API encompass:

  • Multi-window graphics editors à la
    Gimp can space a host of
    bettering tools in precisely positioned home windows.
  • Digital trading desks can point out market trends in more than one home windows any of which is ready to be considered in
    fullscreen mode.
  • Slideshow apps can point out speaker notes on the inside indispensable screen and the presentation on an
    exterior projector.

Recent dwelling

Step Location
1. Develop explainer Total
2. Develop preliminary draft of specification Total
3. Rep solutions & iterate on gain In progress
4. Origin trial In progress
5. Birth Now not started

use the Multi-Show Window Placement API

Enabling by chrome://flags

To experiment with the Multi-Show Window Placement API within the neighborhood, without an origin trial token,
enable the #enable-experimental-web-platform-parts flag in chrome://flags.

Enabling toughen throughout the origin trial half

Starting in Chrome 86, the Multi-Show Window Placement API will seemingly be on hand as an origin
trial in Chrome. The origin trial is anticipated to total in Chrome 88 (February 24, 2021).

Origin trials mean you may perchance perchance presumably envision out novel parts and presents solutions on their
usability, practicality, and effectiveness to the win requirements community. For
more information, look the Origin Trials Files for Web Developers.
To be half of this or one more origin trial, discuss with the registration web page.

Register for the origin trial

  1. Inquire a token on your origin.
  2. Add the token to your pages. There are two ways to support out that:
    • Add an origin-trial label to the pinnacle of every web page. As an instance,
      this will unprejudiced gaze one thing love:

    • In case you may perchance perchance presumably configure your server, you may perchance perchance presumably additionally add the token
      the use of an Origin-Trial HTTP header. The ensuing response header ought to
      gaze one thing love:

      Origin-Trial: TOKEN_GOES_HERE

The topic

The time-examined methodology to controlling home windows,
is sadly blind to additional monitors.
While some parts of this API appear rather outdated, equivalent to its
DOMString parameter, it has however served us properly over the years. To specify a window’s
position, you may perchance perchance presumably creep the
coordinates as left and top (or screenX and screenY respectively) and creep the specified
measurement as
width and top (or innerWidth and innerHeight respectively). As an instance, to birth a
400×300 window at 50 pixels from the left and 50 pixels from the head, that is the code that you
may perchance perchance perchance use:

const popup = window.birth(


"My Popup",



You are going to have the chance to gain information regarding the hot screen by having a stare upon the
window.screen property, which
returns a Show object. That is the
output on my MacBook Air 13″:


Adore most other folks working in tech, I grasp needed to adapt myself to the novel work truth and position up
my private home space of job. Mine seems love on the divulge under (if you occur to are , you may perchance perchance presumably read the
fleshy indispensable aspects about my setup).
The iPad next to my MacBook Air is hooked as a lot as the computer computer by
Sidecar, so every time I would favor to, I’m in a position to fleet turn the
iPad true into a second screen.

School bench on two chairs. On top of the school bench are shoe boxes supporting a laptop and two iPads surrounding it.
A multi-screen setup.

If I would in point of fact like to have excellent thing regarding the greater screen, I’m in a position to put apart the popup from the
code sample above on to the
second screen. I elevate out it love this:

popup.moveTo(2500, 50);

That is a tough bet, since there isn’t a ability to understand the size of the second
screen. The information from window.screen handiest covers the built-in screen, but now not the iPad screen.
The reported width of the built-in screen was 1680 pixels, so transferring to
2500 pixels may perchance perchance perchance work to shift the window over to the iPad, since I occur to keep in mind that it is miles
positioned on the honest of my MacBook Air. How can I elevate out this within the final case? Turns out, there is a
larger intention than guessing. That intention is the Multi-Show Window Placement API.

Characteristic detection

To study if the Multi-Show Window Placement API is supported, use:

if ("getScreens" in window) {


The window-placement permission

Earlier than I’m in a position to use the Multi-Show Window Placement API, I must ask the person for permission to support out so.
The novel window-placement permission may perchance perchance perchance unprejudiced even be queried with the
Permissions API love so:

let granted = false;

strive {

const { grunt } = await navigator.permissions.expect({ title: "window-placement" });

granted = grunt === "granted";

} grasp {


The browser
take grasp of to point out the permission suggested dynamically upon the indispensable try to make use of any
of the methods of the novel API.
Be taught on to be taught more.

The isMultiScreen() methodology

To use the the Multi-Show Window Placement API, I will first call the
Window.isMultiScreen() methodology. It returns a promise that resolves with either factual or false,
reckoning on whether or now not one or more than one monitors are at the moment connected to the machine. For my setup,
it returns factual.

await window.isMultiScreen();

The getScreens() methodology

Now that I know that the hot setup is multi-screen, I’m in a position to salvage more
information regarding the second screen the use of Window.getScreens(). It returns a promise
that resolves with an array of Show objects. On my MacBook Air 13 with a connected iPad, this
returns an array of two Show objects:

await window.getScreens();

Stamp how the worth of left for the iPad begins at 1680, which is precisely the width of the
built-in expose. This allows me to select precisely how the monitors are organized logically (next
to every varied, on top of every varied, etc.). There is additionally information now for every screen to point out whether or now not
it is miles an inside one and whether or now not it is miles a indispensable one.
Stamp that the built-in screen
is now not essentially the indispensable screen.
Each and each additionally grasp an id, which, if
persevered across browser sessions, enables for window arrangements to be restored.

The screenschange match

The ideal ingredient missing now is a ability to detect when my screen setup modifications. A novel match,
screenschange, does precisely that: it fires every time the screen constellation
is modified.
(Uncover about that “monitors” is plural within the match title.)
It additionally fires when the resolution of 1 in all the connected monitors modifications or when a
novel or an easy screen is (physically or almost within the case of Sidecar) plugged in or unplugged.

Stamp that you may perchance perchance grasp gotten to gaze up the novel screen indispensable aspects asynchronously, the screenschange match
itself does now not present this information. This would unprejudiced change within the
. For now you
can gaze up the screen indispensable aspects by calling window.getScreens() as shown under.

window.addEventListener('screenschange', async (match) => {

console.log('I'm there, but largely unnecessary', match);

const indispensable aspects = await window.getScreens();


New fullscreen alternatives

Till now, you may perchance perchance presumably query that parts be displayed in fullscreen mode by the aptly named
methodology. The methodology takes an alternatives parameter where you may perchance perchance presumably creep
FullscreenOptions. Up to now, its handiest property has been
The Multi-Show Window Placement API provides a brand novel screen property that permits you to select
which screen to originate the fullscreen eye on. As an instance, if you occur to would in point of fact like to gain the indispensable screen fullscreen:

strive {

const primaryScreen = (await getScreens()).filter((screen) => screen.indispensable)[0];

await doc.physique.requestFullscreen({ screen: primaryScreen });

} grasp (err) {

console.error(err.title, err.message);



It isn’t that you may perchance perchance presumably envisage to polyfill the Multi-Show Window Placement API, but you
can shim its shape so you may perchance perchance presumably code completely towards the novel API:

if (!("getScreens" in window)) {

window.getScreens = async () => [window.screen];

window.isMultiScreen = async () => false;


The more than a few parts of the API—the onscreenschange match and the screen property of the
FullscreenOptions—would simply below no circumstances fire or silently be neglected respectively by non-supporting


If you are anything else love me, you support a end eye on the development of the a host of cryptocurrencies.
(Primarily I very valuable elevate out now not, but, for the sake of this article, accurate select I elevate out.) To
support discover of the cryptocurrencies that I grasp, I grasp developed a web app that permits me to search
the markets in all existence eventualities, equivalent to from the comfort of my mattress, where I grasp a real
single-screen setup.

Massive TV screen at the end of a bed with the author's legs partly visible. On the screen, a fake crypto currency trading desk.
Relaxing and watching the markets.

This being about crypto, the markets can gain anxious at any time. Would possibly perchance perchance additionally level-headed this occur, I’m in a position to fleet
creep over to my desk where I grasp a multi-screen setup. I’m in a position to click on on any currency’s window
and fleet look the fleshy indispensable aspects in a fullscreen eye on the reverse screen. Below is a fresh
divulge of me taken throughout the closing YCY bloodbath.
It caught me totally off-guard and left me
with my fingers on my face.

The author with his hands on his panicking face staring at the fake crypto currency trading desk.
Panicky, witnessing the YCY bloodbath.

You are going to have the chance to play with the demo embedded under, or look its source code on glitch.

Security and permissions

The Chrome team has designed and conducted the Multi-Show Window Placement API the use of the core
tips defined in Controlling Entry to Unheard of Web Platform Aspects,
collectively with person support an eye on, transparency, and ergonomics. The Multi-Show Window Placement API exposes
novel information regarding the monitors connected to a instrument, rising the fingerprinting surface of
customers, in particular those with more than one monitors consistently connected to their devices. As one
mitigation of this privateness ache, the exposed screen properties are restricted to the minimal indispensable
for general placement use circumstances. User permission is required for sites to gain multi-screen
information and space home windows on varied monitors.

User support an eye on

The person is in fleshy support an eye on of the publicity of their setup. They may be able to accept or decline the
permission suggested, and revoke a previously granted permission by the put apart of dwelling information characteristic in
the browser.


The truth whether or now not the permission to make use of the Multi-Show Window Placement API has been granted is
exposed within the browser’s put apart of dwelling information and is additionally queryable by the Permissions API.

Permission persistence

The browser persists permission grants. The permission may perchance perchance perchance unprejudiced even be revoked by the browser’s put apart of dwelling


The Chrome team needs to hear about your experiences with the Multi-Show Window Placement API.

Provide an explanation for us regarding the API gain

Is there one thing regarding the API that does now not work equivalent to you anticipated? Or are there missing methods
or properties that you may perchance perchance grasp gotten to put in force your knowing? Agree with a expect or touch upon the safety

  • File a spec space on the corresponding GitHub repo, or add your thoughts to an easy

Document an space with the implementation

Did you gain a malicious program with Chrome’s implementation? Or is the implementation varied from the spec?

  • File a malicious program at Guarantee to encompass as valuable ingredient as you
    can, straightforward instructions for reproducing, and enter Blink>WindowDialog within the
    Parts box. Glitch works big for sharing immediate and straight forward repros.

Present toughen for the API

Are you planning to make use of the Multi-Show Window Placement API? Your public toughen helps the Chrome
team to prioritize parts and reveals varied browser distributors how serious it is miles to toughen them.

  • Half how you intend to make use of it on the WICG Discourse thread
  • Ship a tweet to @ChromiumDev with the #WindowPlacement hashtag and allow us to understand
    where and the intention in which you’re the use of it.
  • Inquire varied browser distributors to put in force the API.

Purposeful links


The Multi-Show Window Placement API spec was edited by
Victor Costan and
Joshua Bell. The API was conducted by
Mike Wasserman. This text was reviewed by
Joe Medley,
François Beaufort,
and Kayce Basques.
Thanks to Laura Torrent Puig for the pictures.

Final up as a lot as now:

Enhance article

Read More

Leave A Reply

Your email address will not be published.