Full Screen Browser - with login


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

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:

         "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)
    // Set username value
    var username = document.getElementById("UserName");
    if (username.type != "text")
    username.value = USERNAME;
    // Set password value
    var password = document.getElementById("UserPassword");
    if (password.type != "password")
    password.value = PASSWORD;
    // Click the login button
    logged_in = true;

  setInterval(try_login, 100);

Here’s how managing the scripting JSON file can be made a bit easier. Here’s an example of a script that just clicks an element on

// ^*

The first line is the commented regex of where the script should be active. The following little Python script then takes JS code like this (with their first line being the escaped regex) and converts it to the JSON the package expects. Here’s the script:

import re, sys, json
scripts = []
for fname in sys.argv[1:]:
    with open(fname) as f:
        url_pattern = f.readline().lstrip("//").strip()
        script = "(function() {\n" + + "\n})();"
        scripts.append([url_pattern, script])

Converting is then as simple as:

python example.js  > /tmp/example.json

If you have multiple script files, just specify all of them as arguments to the script.

1 Like