Howto run Chromium browser in full-screen mode on WR web-panels

Howto run Chromium browser in full-screen mode to achieve kiosk-like view on ctrlX HMI using Rexroth WR20x, WR21x web-panels?

Best reply by AndreasSwe

You can use this UI-Action to toggle fullscreen via a button:

/**
 * Custom UI-Action 'ToggleFullscreen'.
 *
 * Description:
 * [Add description here]
 */
(function() {
    var actions = shmi.pkg("visuals.session.userActions"); //get reference to userActions object

    /**
     * UI-Action 'ToggleFullscreen' implementation
     *
     * @params {any[]} parameters  configured ui-action parameters
     * 
     */
    actions["ToggleFullscreen"] = function(parameters) {
       
        var element = document.body;

        var isFullscreen = document.webkitIsFullScreen || document.mozFullScreen || false;

        element.requestFullScreen = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || function() {
            return false;
        };
        document.cancelFullScreen = document.cancelFullScreen || document.webkitCancelFullScreen || document.mozCancelFullScreen || function() {
            return false;
        };

        isFullscreen ? document.cancelFullScreen() : element.requestFullScreen();

    };
}());

It's possible to add this to a LocalScript to toggle fullscreen on startup aswell.

View original
5 replies