Class XbpHTMLViewer2() Foundation

A class for hosting and displaying web content in Xbase++ applications.

Description

The XbpHTMLViewer2 can be used by Xbase++ applications to browse Web pages or view other HTML-formatted text. The class uses the functionality provided by Microsoft's WebView2 component, and hence offers a modern Web rendering engine combined with comprehensive browser functionality. This includes navigation between Web pages, HTML content rendering, JavaScript execution, printing capabilities and event handling for various browser actions.

Various settings of the internal WebView2 component can be configured using the method :setSettings(). This includes disabling the component's default pop-up menu or enabling the internal development console (dev tools).

The method :navigate() is used to load and navigate to a certain Web page. Custom HTTP headers and other parameters of the request can optionally be customized, for example, for specifying user credentials. Dedicated HTML content can be loaded and displayed with the method :setHTML().

Via the method :executeScript(), XbpHTMLViewer2 instances can execute JavaScript code in the context of the current page and return the execution result for further processing in the host application.

Printing is available through the methods :print() and :printToFile(). Both methods allow fine-grained control over the resulting output.

The XbpHTMLViewer2 class requires an installed Microsoft WebView2 runtime in order to be operational. The method :getRuntimeVersion() can be used to check whether the required runtime files are available. See the documentation on :getRuntimeVersion() for more details on the supported platforms and WebView2 runtime installation.

Constructors
:new()
Initializes a new XbpHTMLViewer2 instance.
Class Methods
:getRuntimeVersion()
Gets the version of the installed WebView2 runtime.
Runtime Data
:beforeNavigate
Deprecated. Use method :beforeNavigate() instead.
:navigateComplete
Deprecated. Use method :navigateComplete() instead.
:progressChange
Deprecated. Use method :progressChange() instead.
:statusTextChange
Deprecated. Use method :statusTextChange() instead.
:titleChange
Deprecated. Use method :titleChange() instead.
Life Cycle
:configure()
Reconfigures the XbpHTMLViewer2 object.
:create()
Allocates resources.
:destroy()
Frees resources.
Navigation
:back()
Navigates to the previous location stored in the history.
:forward()
Navigates to the next location stored in the history.
:home()
Navigates to the Home page.
:navigate()
Navigates to a specified URL.
:search()
Navigates to the default search page.
:stop()
Aborts loading a HTML page.
Other
:executeScript()
Execute JavaScript code in the current document.
:isBusy()
Indicates if a document or HTML page is currently being loaded.
:print()
Prints the current page.
:printToFile()
Outputs the current page to a file (PDF).
:queryAllByAttribute()
Gets all HTML elements with a certain attribute.
:queryAllByClass()
Gets all HTML elements given a certain CSS class.
:queryAllByTag()
Gets all HTML elements with a certain tag name.
:queryByAttribute()
Gets the HTML element with a certain attribute.
:queryByClass()
Gets the HTML element with a certain CSS class.
:queryById()
Gets the HTML element with a certain identifier.
:queryByTag()
Gets the HTML element with a certain tag name.
:queryByXPath()
Gets information about HTML elements.
:refresh()
Reloads the current document.
:setHTML()
Assigns HTML-formatted text to the object.
:setSettings()
Configures the internal WebView2 component.
Callback methods
:beforeNavigate()
A navigation is about to begin.
:documentComplete()
A document is completely loaded.
:navigateComplete()
A navigation is complete.
:progressChange()
A progress change occurred in the current operation.
:statusTextChange()
The status text has changed.
:titleChange()
The title of the current document has changed.
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.