Chrome extension for kiosk monitoring and reboot if necessary

I have a kiosk that handles portraits of people. He works in chrome.

One in 200 people who use a kiosk ends up freezing it during the process. When it freezes, I never get "ah snap", and the page is just curious.

I was wondering if it is possible to make an extension to control the page and check for heart rate - if this is not visible after 30 seconds, reload the window.

Any help would be great.

+5
source share
1 answer
  • You have script content on the kiosk page, send a message every X seconds back to the wallpaper

    In the contents of the script:

    var port = chrome.extension.connect({ name: "keep-alive" });
    
    port.postMessage('is-alive', { alive: true });
    
    setInterval(function () {
        port.postMessage('is-alive', { alive: true });
    }, 1000 * 15);
    
  • , ,

    :

    var last = Date.now();
    var interval = 1000 * 15;
    
    chrome.extension.onConnect.addListener(function (port) {
        if (port.name === 'keep-alive') {
            port.onMessage.addListener(function (data) {
                if (data.type === 'is-alive' && data.payload.alive === true) {
                    last = Date.now();
                }
            });
        }
    });
    
    setInterval(function () {
        if (Date.now() - last > interval) {
            // Reload the tab...
        }
    }, interval);
    

. chrome.tabs. tabs .

, . Messaging docs.

+5

All Articles