OBrowser allows you to very easily embed a web page or whole website into your thick client windows – in fact, we use it in the Hub in the Studio Browser to display news & info about Omnis Software. Even though the OBrowser control is a fully featured web browser, it is best suited to embedding specific web pages, rather than use as a general purpose, standalone web browser. The OBrowser component is available in the External Components group in the Components Store and can be added to a window class like any other component.
In Omnis Studio 10.1 the macOS version of OBrowser now uses the Chromium Embedded Framework (CEF), which the Windows version of OBrowser already uses, which means OBrowser on macOS now supports the standard OBrowser CEF configuration settings using the cefSwitches configuration item in the config.json (as on Windows).
Displaying a web page
To use the OBrowser component as a standard browser you need to set the $urlorcontrolname property to a full URL with a prefix either http://, https:// or file://, such as ‘http://www.omnis.net’. In design mode this will be a static page, but in runtime the page will behave exactly as expected for a standard browser (although popups are not allowed). As the end user navigates the web page, the read-only property $currenturl contains the URL of the page currently open. The OBrowser component has various methods you can use to control the content, including $forward() and $back(), plus $setdataurl() assigns a data URL to the component. The component also reports various events, including evBrowserOpenUrl, evBrowserStartDownload and evBrowserLoadStateChange. There is an example app using OBrowser under the Samples option in the Hub in the Studio Browser.
The OBrowser object has a section in Omnis configuration file (config.json) named “obrowser”, including ‘logSeverity’ for configuring error logging, as well as options to control the cache and debugging.
HTML Window Controls
To add an HTML control to a window class, you need to add the OBrowser object to the window, which is available in the External Components group in the Component Store, and set its $urlorcontrolname property to the name of the control (rather than a web URL) – this property displays a droplist containing the names of all the available controls installed into the htmlcontrols folder in your Omnis development tree.
JS Client Bridge
You can download the JS Client Bridge from our GitHub page: