0

is there any way to know extends screen in javascript?

by screen.availWidth and screen.availHeight you can only know the width and height just for the main screen

Eonasdan
  • 7,563
  • 8
  • 55
  • 82

1 Answers1

1

If you are referring to how to detect extended screens (on two monitors), and your browser window is going on both screens, you can detect with the following code:

var extendedScreen = ( window.innerWidth > screen.availWidth );

But the code above won't work if the browser width is less than the available width of the screen. I don't know of a generic method to detect.

Have a look also to https://stackoverflow.com/a/9788029/279262 for a cross-browser function that detects the screen width.

Community
  • 1
  • 1
Alberto Arena
  • 344
  • 3
  • 12