Skip to main content

Editor for scripts in TheFlex

Local scripts for any websites and web apps can be configured in the TheFlex settings. These can be used to add functions or make visual adjustments without having to change the website.

Code editor for local scripts

Hello world

Normal Javascript can be used to adapt websites.

Customize CSS

The appearance of the page can be changed by adjusting the CSS.

Page Ready Event

The page is only fully loaded and rendered after this event.

Open dialog with autofocus

This script opens a customizable dialog with autofocus in which you can scan directly.

Loading...
0 of 3000 characters is used (minified)

Important information for scripts

Recommendation

If it is possible to maintain and deliver these scripts directly in the website, then this option should always be preferred. However, if this is not possible, the functionality of the local scripts can be used. Examples of when these local scripts can be used appropriately include

  • Visual adjustments to old websites (e.g. ITS-Mobile) that can no longer be changed or are difficult to change.
  • Visual adjustments to websites for some special devices.
  • Adding login functionalities (e.g. login via NFC chip or QR code) to login pages that cannot be changed (e.g. Microsoft Azure or SAP).
  • Adding any scripts to websites or web apps of other service providers without access to their source code.

deviceready-event

If certain elements, e.g. an input field or button, are to be accessed in the script, the deviceready event must be waited for. Only then is the page fully loaded and all elements available:

document.addEventListener("deviceready", function () {
// my script
});

Active URL

For each script, a URL can be defined for which the script is active. This means that the script is only injected for these URLs. However, the script does not check for this exact URL, but only whether the current URL starts with the configured URL.

Example: The URL https://theflexbrowser.com is opened.

  • If https is configured as the URL for the script, then this script will be executed.
  • If https://theflexbrowser is configured as the URL for the script, this script will be executed.
  • If https://other.com is configured as the URL for the script, this script will not be executed.
Caution

It must be carefully checked which scripts are executed, as these have full access to all data within the website accessed as well as all user input.

Transfer scripts into the browser

There are three ways to transfer the script from this editor to the browser:

1. Maintenance via an MDM

The easiest way is to roll out the scripts via an MDM such as SOTI or Intune. The scripts can also be managed in these tools, whereby they are automatically transferred to the devices.

2. Import via QR code

If the script is shorter than 3000 characters, it can be displayed here as a QR code using the Export as QR code button. In the TheFlex browser settings, this QR code can be scanned in the scripts via Import script.

3. Screenshare

This option is only recommended for development purposes. If the device is connected to this PC, the scripts can be copied to the browser settings using ctrl-c and ctrl-v.

Note

A further option is planned for the Q3 2024 release to make it even easier to transfer the scripts from this PC to any TheFlex browser. As soon as this new function can be used, it will be announced in this article and in the changelogs.