info-beamer

Full Screen Browser - with login


#1

HI

Is is possible to use the full screen browser with an URL that requires authentication / login?


#2

Yes. That’s possible with using the scripting option. But that’s really clunky: Basically you can assign a JSON asset with the following structure:

[
    [
         "http://.*foo.com/login",
         "alert('hello world')"
    ], ...
]

For every page/frame/iframe loaded, the service looks if one of the urls regexes match. If so it runs the JS part in the context of that page. It’s really challenging to debug.

As an example of what a JS snippet might look like:

(function() {
  var USERNAME = "foo", PASSWORD = "bar";
  var logged_in = false;
  function try_login() {
    if (logged_in)
      return
    
    // Set username value
    var username = document.getElementById("UserName");
    if (username.type != "text")
      return;
    username.value = USERNAME;
  
    // Set password value
    var password = document.getElementById("UserPassword");
    if (password.type != "password")
      return;
    password.value = PASSWORD;
  
    // Click the login button
    document.getElementById('loginButton').click()
    logged_in = true;
  }

  setInterval(try_login, 100);
})();