Starting External Applications from Web Pages

Here are two examples that show how you can start external applications from a web site in the SiteKiosk browser. One example is for the Internet Explorer engine of SiteKiosk, the other for the Chrome engine.

The first example is a simple HTML page with two buttons for the IE engine of SiteKiosk. The first button just starts the Notepad application of Windows. The second button starts Notepad with a parameter that includes the full path to a file that should be displayed in Notepad.

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>App Start with the SiteKiosk Object Model (IE Engine)</title>

    <script>
        //Initializing the SiteKiosk Object Model for IE engine
        window.external.InitScriptInterface();

        //Running the external application using a universal method for optional parameter usage
        function runExtApp(extapppath, extappparameter) {
            var completepath = extapppath;

            //Check if parameter is not empty and adding parameter to path
            if (extappparameter !== "")
                completepath += " " + extappparameter;

            SiteKiosk.ExternalApps.Run(completepath, false);
        }
    </script>
</head>
<body style="margin-left:auto;margin-right:auto;margin-top:50px;text-align:center;">
    <input type="button" value="Start Notepad without parameter" onclick="runExtApp('c:/windows/notepad.exe','');"/><!--You can either use single forward slashes in the path-->
    <input type="button" value="Start Notepad with parameter" onclick="runExtApp('c:\\windows\\notepad.exe', 'C:\\Program Files (x86)\\SiteKiosk\\Html\\extapptest.txt');"/><!--Or you can use double backward slashes in the path-->
</body>
</html>

Embedded in the normal HTML and Javascript code is the SiteKiosk Object Model. The Run method of the ExternalApps object is used to start an external application.

SiteKiosk.ExternalApps.Run(completepath, false);

You can learn more about the Run method here.

For security reasons you need to specifically allow pages you are using the SiteKiosk Object Model on in the SiteKiosk configuration.

To test the above example code you can either put it on your web server but you can also save it locally as an html file in the ..\SiteKiosk\html folder of your SiteKiosk installation. The test code also assumes that there is a local text file available in ..\SiteKiosk\html named extapptest.txt for the parameter variant.

The result will look like this:

The second example is a slight variation from the first and demonstrates the same behaviour in SiteKiosk when using the Chrome engine. The SiteKiosk Object Model for the Chrome engine differs from the one for the Internet Explorer engine. The HTML and Javascript parts are identical but note the different way to initialize the Object Model.

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>App Start with the SiteKiosk Object Model (Chrome Engine)</title>

    <!--Initializing the SiteKiosk Object Model for Chrome engine-->
    <script>(new Function(_siteKiosk.getSiteKioskObjectModelCode()))();</script>

    <script>
        //Running the external application using a universal method for optional parameter usage
        function runExtApp(extapppath, extappparameter) {
            var completepath = extapppath;

            //Check if parameter is not empty and adding parameter to path
            if (extappparameter !== "")
                completepath += " " + extappparameter;

            siteKiosk.system.windows.skLegacy.externalApps.run(completepath, false);
        }
    </script>
</head>
<body style="margin-left:auto;margin-right:auto;margin-top:50px;text-align:center;">
    <input type="button" value="Start Notepad without parameter" onclick="runExtApp('c:/windows/notepad.exe', '');"/><!--You can either use single forward slashes in the path-->
    <input type="button" value="Start Notepad with parameter" onclick="runExtApp('c:\\windows\\notepad.exe', 'C:\\Program Files (x86)\\SiteKiosk\\Html\\extapptest.txt');"/><!--Or you can use double backward slashes in the path-->
</body>
</html>

The line that actually starts the external application is also specifically suited for the Chrome engine:

siteKiosk.system.windows.skLegacy.externalApps.run(completepath, false);

The functionality and accepted parameters of the run method are the same as for the IE version. Currently there is no detailed documenation available for the SiteKiosk Object Model for Chrome-based browsers in SiteKiosk Windows and SiteKiosk Android, please contact our support to receive a basic documentation.

Using the Chrome example in one of the Chrome browser versions of SiteKiosk will look like this:

When working with external applications please note the information from the SiteKiosk documentation.