0

I know this question might be understood as duplicate, but believe me, I have searched almost all the web and could not find an answer that fits the scope of my application. In 90% of the cases, the answer is "no, you can't due to security issues.

My application in specific was designed to be a local application. I need that the client workstation trusts my system and lets it manipulate F11 key.

I'm using ASP, jQuery, CSS3, HTML5, MySQL.

Is there any way to do that? I'm thinking of something like a Java applet.

I'm using this JavaScript code:

function toggleFullScreen() {
    if ((document.fullScreenElement && document.fullScreenElement !== null) ||    
        (!document.mozFullScreen && !document.webkitIsFullScreen)) {
        if (document.documentElement.requestFullScreen) {
            document.documentElement.requestFullScreen();
        } else if (document.documentElement.mozRequestFullScreen) {
            document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.webkitRequestFullScreen) {
            document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
        }
    } else {
        if (document.cancelFullScreen) {  
            document.cancelFullScreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
        }
    }
};

Which works well, but if ESC key is pressed or any modal event occurs, it restores the viewport to its previous size.

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • 3
    Maybe I'm missing something, but why tag this as a Java question? How does this relate to Java programming? – Hovercraft Full Of Eels Dec 31 '17 at 14:49
  • @GhitaB in this specific case I need the application to be established in fullscreen, like when user press F11 Key. Faithfully. – A. Cristian Nogueira Dec 31 '17 at 14:55
  • @HovercraftFullOfEels I thought that it could be possible using a JAVA applet to trust the computer where it is hosted. It isn't? – A. Cristian Nogueira Dec 31 '17 at 15:02
  • You want to write a web application that takes over the screen and prevents the user from looking at anything else? – VGR Dec 31 '17 at 21:37
  • @VGR Exactly. The system I'm working at kind simulate an operating system inside the browser (Window, icons, gadgets, etc...). That's why I need this solution. – A. Cristian Nogueira Jan 02 '18 at 19:54
  • 1
    You might be able to make a full screen application with a trusted applet, but applets are [deprecated](https://docs.oracle.com/javase/9/docs/api/java/applet/Applet.html), and you would need to get a code signing certificate, and you still can’t prevent users from switching applications. Programs that prevent switching applications are known as ransomware. If you do manage it, don’t expect users to have kind words for you. I would just make a desktop application that makes itself full-screen, and if users want to switch to something else, don’t bother trying to prevent it. – VGR Jan 02 '18 at 21:32
  • @VGR it doesn't matter actually if user want to switch from my application to another. I just don't want that the system turn off fullscreen when ESC key is pressed or when a modal event occurs, like javascript alert (). – A. Cristian Nogueira Jan 03 '18 at 23:23
  • Then it sounds like you want to create desktop application, using JavaFX or Swing. I’m not sure what you want is possible in a web application. – VGR Jan 04 '18 at 02:43

0 Answers0