Testing for multiple screens with javascript

I didn’t find the answer I needed anywhere on StackOverflow, so responding late to the several related threads here. The solution is, first, check for secondary display with window.screen.isExtended. Then await window.getScreenDetails(), which returns an object that includes an array of screens.

Very thorough explanation here: https://web.dev/multi-screen-window-placement/

Leave a Comment