5

I am trying to create, essentially, a 'kiosk'

I have an web application that I want to be the only thing accessible on screen. I know chrome has a 'kiosk' mode (shortcut: chrome.exe --kiosk www.url.com). That takes care of the auto-fullscreen, but disables very few shortcuts (perhaps only f11).

With a bit of help from the internet, I wrote out some javascript that gets most of the job done. The code is as follows:

window.onload = function() {
    window.document.body.onkeydown = function() {
        if (event.ctrlKey) {
            event.stopPropagation();
            event.preventDefault();
            try {
                event.keyCode = 0; // this is a hack to capture ctrl+f ctrl+p etc
            }
            catch (event) {

            }
            return false;
        }
        return true; // for keys that weren't shortcuts (e.g. no ctrl) then the event is bubbled
    }
}

This takes care of things like ctrl+f, ctrl+p, etc. Unfortunately, it does not disable shortcuts such at ctrl+t, ctrl+n, f5, etc.

Is it even possible to disable these, or am I chasing a rainbow here? I don't care if it's javascript, settings, whatever, but I would really like to do it without a plugin.

Ledivin
  • 637
  • 5
  • 18

1 Answers1

3

You can disable any keys you want via javascript. You just need to know the key code for them.

Mike Brant
  • 70,514
  • 10
  • 99
  • 103
  • 1
    The problem I'm seeing is that something like ctrl+t or ctrl+n don't event send an event that JS can catch - it looks like it's immediately opening a new tab/window without the javascript even being able to do anything about it. But you ARE right regarding capturing F5 :) Thanks – Ledivin Jul 25 '12 at 19:23
  • From doing some googling it looks like you can intercept these in very new versions of chrome when Chrome is launched in app-mode. – Mike Brant Jul 25 '12 at 19:27