You may want to write a script that has to open a certain file in a browser, for example a generated diagram image that should be shown to the user. That image is most likely located in the local file system and ideally should be shown in a browser window inside medini (aka an internal browser window).
Opening some URL in a browser window is a generic feature of the medini tool and used for other use cases as for example the help system. And it can be rather easily exposed to a script. In the attached updated ui.js you will find two new methods:
/**
* Opens a given object in the external browser. The following types are
* supported: java.io.File and string.
*
* @param object URL string or File object
*/
function openInExternalBrowser(object);
/**
* Opens a given object in the internal browser. The following types are
* supported: java.io.File and string.
*
* @param object URL string or File object
* @param id optional unique id of this browser window, default is 'OpenInInternalBrowser'
* @param name optional window name
* @param name optional window tooltip
*/
function openInInternalBrowser(object, id, name, tooltip);
Usage is straight, as mentioned in the API doc you may pass a URL string or a java.io.File object. For example:
openInExternalBrowser("https://www.mediawiki.org/wiki/MediaWiki");
var what = new java.io.File("C:/temp/sample.png");
openInInternalBrowser(what, "MyImage", "Image", "Image from file system");Note that the last 3 parameters are optional.
Happy Scripting
Jan