7

I developed a web app to display a slideshow, and want to display it on my secondary monitor (Connected via HDMI) with IE's Kiosk mode on Windows 10. Because of CPU and other resources on the shared server, I want to pause the slideshow when the monitor is powered off. (And therefore nobody is seeing it)

Is there a way to detect connected displays from Internet Explorer? Since this is a one-pc kiosk setup, add-ons, etc. are accepted. Triggering javascript/jquery events would be ideal. Thank you!

GiantDuck
  • 1,086
  • 3
  • 14
  • 27
  • 2
    I'd truly hope not; I don't want my browsers to know *anything* of my machine. – David Thomas Nov 25 '14 at 01:16
  • @DavidThomas, I **think** a website can already detect it is not in the foreground. – Ian Ringrose Nov 25 '14 at 10:24
  • 1
    @IanRingrose Yes, I can detect if the tab/window is focused. But even if the monitor is turned off, this is static. – GiantDuck Nov 25 '14 at 11:59
  • Why dont you have a script running on the machine which checks if the display is off, then it clicks the pause button on the slideshow. I would think that this is the only way to do it since from a security point of view, a webpage should not be able to know what kind of hardware is connected to the machine that the page is displayed on. – stackErr Nov 28 '14 at 18:00
  • @stackErr 1) How would I check if the display is off? 2) I'm fine with addons, activex, etc. – GiantDuck Nov 29 '14 at 11:10
  • maybe adobe flash can detect it, and you can create some callback from flash to javascript to pause you slideshow, and you can embed this with no visibility. or use ajva, but user neet to allow its execution. or silverlight – Erik Kubica Dec 05 '14 at 13:58

4 Answers4

0

No, there is no reliable way to detect if a second monitor is physically switched off but still connected via the cable.

I have to ask though: why do you need to physically switch the second monitor off?

As an alternative could you not:

  • Have the slideshow stop after a timed duration unless it receives an input?
  • Have the slideshow only on display at certain times of the day?
  • Accept events from, say, a node server to control when to and not show the slideshow?

Having said that these threads could provided you, albeit unreliably apparently, what you need:

Community
  • 1
  • 1
Calummm
  • 819
  • 1
  • 8
  • 21
0

You can't do in javascript. Why not try some asp component.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd162617%28v=vs.85%29.aspx

thunder
  • 230
  • 1
  • 8
0

You could potentially write a command line program that sits on a particular port, continuously checks for that locally and then use HTML5 WebSockets in IE to communicate with it?

i.e. C# PowerModeChangedEvent

SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler( SystemEvents_PowerModeChanged );

Squiggs.
  • 4,299
  • 6
  • 49
  • 89
-2

I don't think so....

CPU cycles are paused when the client computer is put into Sleep mode. (win+L)

Start>Control Panel>Power

configures how the monitor(s) behave when the client is powered down or put to sleep mode.

the screen object in js returns the metic values (height/width) of the screen object but not its powered state.

the impact of wasted CPU cycles on a powered down secondary monitor should be un-noticable....

probably you have not selected the option to "Use software rendering instead of GPU rendering" on the Advance tab of internet options....

You will notice that your CPU on your desktop will throttle up and the cooling fan will race if you haven't set the above setting when running graphic intensive web pages or canvas scripts.

Rob Parsons
  • 839
  • 6
  • 4
  • First of all, last time I checked winl put the computer in Locked mode. Not sleep. Secondly, the CPU cycles used to show a browser window might e minimal, but the OP is showing a slideshow in the browser. That probably means decoding pictures. Which is not CPU friendly. – Hennes Nov 25 '14 at 18:05