7

How to find dual monitor (secondary monitor) screen width and height? Using javascript or jquery. Can anybody help?

azt
  • 2,100
  • 16
  • 25
Pandiyan
  • 129
  • 1
  • 1
  • 7
  • This is not possible with jquery/javascript, you can get the current screen with screen.width and screen.height – Maarten Peels May 08 '15 at 12:55
  • What problem are you actually trying to solve? Why do you need both monitor's height and width? There may be another way to solve your problem without it. – George Stocker May 08 '15 at 13:43
  • On click we are opening a new window in second monitor. The window height and width should be the current monitor. But it is taking primary monitor height and width. – Pandiyan May 11 '15 at 08:56
  • @Pandiyan : i face same issue, have find any solution ? – Heroic Apr 12 '16 at 10:17
  • 1
    This is a programming question specifically directed at the javascript domain, why it was closed is beyond me. – bug-a-lot Nov 18 '16 at 10:41
  • Anyone has found the solution? – Mark Jan 04 '17 at 18:43

1 Answers1

5

You can't detect a second monitor using Javascript, if you would get screen.width it would just show the total screen width of both monitors. You could however use window.innerWidth to get the size of the web page on the screen as mentioned here: Detect screen width for multiple monitors

Community
  • 1
  • 1
Mathias
  • 171
  • 1
  • 2
  • 13
  • yes, I am able to find screen width but not able to get screen height. Both monitor where different resolution. I am able to open new window in second screen. But it should be open maximum window size of the second monitor. – Pandiyan May 08 '15 at 13:12
  • @Pandiyan Do you mean something like window.innerHeight ? – Mathias May 08 '15 at 13:15
  • If you want to resize the window to the max I would try to open the new window on the second monitor and then do myWindow.resizeTo(window.innerWidth, window.innerHeight); Where myWindow is the new window you just opened, remember to assign it to a variable. – Mathias May 08 '15 at 13:18