Is there a way to control browser size and position across multiple displays / monitors?
Asked Answered
H

5

8

Preface

First of all, I am very well aware that webapps should not fiddle with window size or position. Been through a lot of similar SO questions and forum posts.

But this is a special case, where the browser is just a platform to run an app on several specific machines in a controlled environment.

Task

The app should manage windows across several displays. (up to 5)

What I've tried until now

  1. Searched for methods for gaining information about the host system display information, but the window.screen object only reports properties of the display the window is currently on (or considered to be on, if it is halfway on one)
  2. Tried window.moveTo and window.open with flags "left=123,top=123" but they are always limited to the current display
  3. Tried window.resize and window.open with flags "height=123,width=123" but just as with the moveTo they are limited to the current display.

Question

What could I do to make my application use (without manual window positioning) all the available space in a multi display environment?

Scenario

Think of it like I have two projectors correctly aligned, and would like to make it possible for:

  • each project to project different things (each projector projecting its own browser window)
  • project an app seamlessly across both projectors (possibly fullscreen)

There could/should be a window running the master window layout logic

Note

I can use any flags, app or kiosk mode, as again: we deploy the app to the target environment.

The browser options are Chrome(preferred), Chromium, and Firefox on a Windows platform (because of the special video card we will be using for 5 displays).

Fallback solution

Manually stretch a window across available displays and run the apps in iframes within this master window.

Drawback: A single process is running everything, so should an app break within a frame it breaks everything.

Afterword

Also a solution to this question would be a great help as well: Windows / Chrome / ATI / Browser fullscreen across multiple monitors

Habitable answered 5/2, 2014 at 14:8 Comment(2)
Can you clarify what you mean by "use" exactly? How do you need the window/s repositioned/resized?Astronomical
I would like to be able to open browser window on specific display spanning across 1-4 displays.Habitable
D
3

Go with a chrome/firefox extension that has access to window/tabs specific APIs. Either embed your whole application in the extension or communicate with the extension through messages (chrome, there's an equivalent on firefox).

Support in Chrome is experimental.

Daryldaryle answered 5/2, 2014 at 14:21 Comment(0)
A
1

You can use window.moveTo(-1000,100) to move a pop up to a second monitor in IE if you check the permission "allow script-initiated windows without size or position constraints" under Internet Options/Security/custom level.

If you only have a single monitor connected, it will move the window to the edge of the primary display. I have not found a way to do it in Chrome though, it doesn't appear to have the same security option.

Artema answered 4/8, 2014 at 22:22 Comment(0)
P
1

Try using the chrome.windows API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.

https://developer.chrome.com/extensions/windows

It even works with nightwatch.

Polyglot answered 5/2, 2016 at 22:25 Comment(0)
E
0

I don't think it's possible. Browser really limit JavaScript in its permissions for security reasons. Maybe you can manually(in JavaScript of course) set the x and y position far outside of the screen so it appears on another screen but that's not a neat way to do it.

As far as I can think of, you have two options:

  1. Create different pages for every screen and open them separately every time.
  2. Create all the windows with a button and make the user drag them to the corresponding screen. When the user clicks the button open the window in full screen/kiosk mode and load the content. However I don't know what will happen if you activate another screen while your in fullscreenmode somewhere. It might invalidate and close the fullscreenmode.

This is the only way you can have distinct windows in your browsers as far as I know.

Epagoge answered 5/2, 2014 at 14:20 Comment(0)
H
0

Another possible solution is to use the win32 to size & position the window.

As seen in the solution of question: Chrome Packaged App and Dual Monitors (no code there, this is just for reference)

Habitable answered 5/2, 2014 at 14:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.