[Pas2js] page reload when server restarted not 100% reliable

Luca Olivetti luca at ventoso.org
Mon Sep 22 16:19:45 CEST 2025


I have ~20 clients (windows 11 in kiosk mode with edge as the kiosk 
application). They're touch screen only, no keyboard or mouse.
The pas2j application tries to reload the page when the connection is 
severed (it's using a TJSEventSource and the server sends a message 
every 5 seconds).q
The problem is that, from time to time, the page is blank (I cannot 
simply hit F12 to see what's happening since it's in kiosk mode).
On a non-kiosk instance I found that the pas2js application or another 
js library wasn't completely loaded while starting the application hence 
causing an exception, so I came up with this workaround (and, yes, first 
I tried just with the try..catch but it didn't work).




<!DOCTYPE html>
<html>

<head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <title>Pantalla</title>

     <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
     <link rel="stylesheet" type="text/css" href="fa/css/all.min.css">
     <link rel="stylesheet" type="text/css" href="choices/choices.min.css">

     <link rel="stylesheet" type="text/css" href="css/pantalla.css">
     <script src="js/bootstrap.bundle.min.js"></script>
     <script src="choices/choices.min.js"></script>
     <script src="js/qrcode.js"></script>
     <!--- below my pas2js application ------------------->
     <script src="sesewebclient.js"></script>

</head>

<body>

....

     <script>
        if (typeof rtl === 'undefined' || typeof QRCode === 'undefined') {
          console.log('rtl o QRCode no definidos, recargo pagina');
          setTimeout(function() { location.reload(); }, 5000);
        } else {
           try {
             rtl.run();
           } catch(err) {
             console.log('error '+err.message+', recargo pagina');
             setTimeout(function() { location.reload(); }, 5000);
           }
        }
     </script>

</body>
</html>


but today, even with the check on rtl and QRCode, I got a blank page 
when I restarted the server, maybe something else wasn't loaded.
This is strange because the rtl.run() shouldn't fire if all the other 
parts haven't been completely loaded, right? An edge quirk?
In any case, if this happens, is there a way to make the try..catch 
work, so I don't have to check all of the libraries?

Bye
-- 
Luca



More information about the Pas2js mailing list