Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Monitor Count

I have a web application that I'd like to implement the following behavior.

When you click on a specific link:

  • If the user has more than one monitor - open the url in a window with a given name.

  • Otherwise - change the iframe's src attribute to that of the url.

How do I detect the monitor count in JavaScript?

If it's impossible, a Chrome only solution would also work since this is for an intranet app.

like image 346
Benjamin Gruenbaum Avatar asked Oct 21 '22 02:10

Benjamin Gruenbaum


1 Answers

As others have said the only sensible way to do this is to ask the user. A proposal to allow this has been raised and declined before. Multi monitor setups are not very common in the general population which is why this is ignored.

The alternatives are:

  • Prompt the user.
  • Ask the user to run a browser extension (less fun and more risky).
  • Run through a plugin (also not very fun).
  • Serve your app through something like WebkitJS

Overall - for normal websites the only option is to prompt the user.

like image 94
Benjamin Gruenbaum Avatar answered Oct 27 '22 11:10

Benjamin Gruenbaum