Detect Display Type (Projector) from within the br

2019-08-26 15:24发布

问题:

It goes like this, we need to detect if the display is a Projector (or if the system is connected to a Projetor).

the catch is this should be done from within the browser.

so is it possible to do so by using an

Java Applet

Flash

ActiveX (this does constrains to a single browser, so not an option)

searching so far only reaveals display resolution. expecting if there is something still out there. . .

Edit: accecpted answer is for Java Applet approach. hope there may be an easier way through flash...

回答1:

A normal Java Applet will not be able to tell you whether you're viewing through a projector.

If you can detect whether you're running on a projector from native code then you could code a library up to do so and access it from your Applet with JNI. You'll need to sign your applet and wrap your library loading with AccessController.doPrivileged()

Here's explanation of how that last bit works: http://download.oracle.com/javase/1.4.2/docs/api/java/security/AccessController.html

By all accounts, Java Web Start provides an easier path for using DLLs from Java though: http://mindprod.com/jgloss/jni.html#APPLETS



回答2:

Use CSS.

selector {
    property: value1;
}

@media projection {
    selector {
        property: value2;
    }
}

You could use JavaScript to detect the different value. :)

if (element.getPropertyValue(property) === value2) /* Some JavaScript stuff. */