Keep connection alive by periodically fetching content

Jun 15, 2014

The IT admin at dad’s office is a meanie. All users are connected to the intranet by default. They have some sort of login-thing for internet access where each user has to login from their computer with their credentials in order to get connected to the internet. And if a user doesn’t visit a webpage for more than 5 minutes, they get automatically logged out. And running downloads don’t count, so even if my dad has a download going, he gets disconnected if he doesn’t visit/reload a page once every five minutes. I’m not quite sure how this is accomplished, but I’m guessing they’re tracking new HTTP connections or perhaps DNS lookups.

Anyhow, I wrote a webpage with simple piece of javascript that fetches the same image once every four minutes. And it works, his connection doesn’t get dropped while this webpage is open.

<html>
  <head>
  <meta http-equiv="Content-Language" content="en-us">
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
  <title>SVP Page Refresh</title>
  <script language=JavaScript>
    function Refresher(t) {
      if(t) {
        setTimeout(refresh, t*1000);
      }
    }

    function refresh () {
      location.reload()
    }
    </script>
  </head>

  <body onLoad="Refresher(240)">
    <p>SVP Page refresh</p>
    <img src="http://www.polyvore.com/cgi/img-thing?.out=jpg&size=l&tid=22275098" style="width: 300px; height: 300px;" />
  </body>
</html>

Made my dad happy, so I’m happy.