2

I am trying to create a simple quiz web app for students. They should not be able to access anything on the computer except the quiz questions.

So I found some methods like here to make the browser fullscreen. However, that does not prevent them from hitting escape key or F11 to exit the fullscreen mode, or they can hit the windows key to bring up windows menu (Hence accessing other programs in the computer).

Is there any way to stay in the fullscreen mode permanently and exit only with one of the admins' passwords (Just like TOEFL iBT exam). Is that possible through browser or I should write a native full-fledged program for that task?

Community
  • 1
  • 1
Polla A. Fattah
  • 801
  • 2
  • 11
  • 32
  • 2
    should not be possible, otherwise you could never close very annoying popup ads without restarting your computer. The other thing you could do, is detect keyboard presses (if they're only supposed to use the mouse). And warn them that they are not to do so. If they do it, say, 3 times in total for the whole quiz, they automatically fail it. Of course there are still ways around this, but at least this might scare some into doing it properly. – A. L Feb 21 '17 at 00:18
  • @A.Lau Yes that is possible, but if there is better ideas I will be really grateful – Polla A. Fattah Feb 21 '17 at 00:21
  • 1
    You're looking for Chrome's Kiosk Mode. – SLaks Feb 21 '17 at 00:22
  • what does 'yes that is possible' mean? – A. L Feb 21 '17 at 00:25
  • @A.Lau Your idea about preventing them from using keyboard and counting keyhits – Polla A. Fattah Feb 21 '17 at 00:26
  • Then you should look up fullscreening code and `onkeypress` event code as well, then combine them together. Don't have time right now to do it. – A. L Feb 21 '17 at 00:28
  • @SLaks Maybe stupid question but Is there any way to get into kiosk mode using javascript. Because there are more than 100 computers. – Polla A. Fattah Feb 21 '17 at 00:29
  • Is there any way to catch special keystrokes I(like escape) and do not let it sink the browser so that I can prevent these keystrokes from changing the screen mode? – Polla A. Fattah Feb 21 '17 at 00:32
  • You could use `onkeydown` instead. Just experiment – A. L Feb 21 '17 at 00:37
  • For security reasons, that is completely impossible. You should use proper systems management tools to deploy to every computer. – SLaks Feb 21 '17 at 04:09

2 Answers2

2
function checkWH(){
    if((window.outerWidth-screen.width) ==0 && (window.outerHeight-screen.height) ==0 )
    {
        alert('fullscreen');
    }
}

$(window).keypress(function(event){
    var code = event.keyCode || event.which;
    if(code == 122){
        setTimeout(function(){checkWH();},1000);
    }
});

I think you can use something like this.

Amit
  • 451
  • 1
  • 6
  • 19
0

You can start certain browsers in "kiosk mode" which is meant to be used for running fullscreen applications on unmanned kiosks.

Based on this tutorial http://lifehacker.com/use-chromes-kiosk-mode-to-limit-someones-access-to-yo-1243433249

  • Open up Chrome's settings.
  • Under "Users" click "Add new user."
  • Give the new profile a name and picture. Make sure "Create a desktop shortcut for this user" is checked. Click "Create."
  • Right-click the newly-created shortcut and select "Properties."
  • In the "Target" field, add "--kiosk" (no quotes) to the end.
  • Click "Apply."

This puts the browser into a fullscreen mode and significantly reduces the ways you can escape from the browser but it isn't perfect; Alt+F4 will close the browser on Windows, for example.

You might be able to write a script to capture keypresses and discard any that press Alt or a function key, but this is fairly fragile and could affect the ability to actually type in answers.

The only other way around this is to not supply a hardware keyboard. Either build your quiz to only use pointing devices like a mouse or touch. If you need a keyboard, consider providing an on-screen keyboard with a limited key set.

Soviut
  • 88,194
  • 49
  • 192
  • 260
  • 1
    It's probably a home-accessible type of web app, otherwise if it's in-house, I don't see why they don't just supervise students instead. But of course if it's in-house, if they alt-f4 that's pretty much an auto fail there – A. L Feb 21 '17 at 00:26
  • @A.Lau Because of two things 1- the computer lab is large (more than 100 computer) 2- Teachers will not use the system if they know that there is a possibility that the students can do other stuff. (like browsing for answers) – Polla A. Fattah Feb 21 '17 at 00:36
  • 1
    @PollaA.Fattah If that's a major concern, then an actual OS application might be more applicable. – A. L Feb 21 '17 at 00:38
  • How are you going to prevent students from browsing for answers on their phones? – Soviut Feb 21 '17 at 01:07