From Clomosy Docs

The TCLProWebBrowser class provides a fully integrated web rendering component for displaying and interacting with web content directly inside Clomosy forms. It supports standard web navigation, HTML rendering, JavaScript execution, caching control, and developer debugging tools. TCLProWebBrowser allows you to embed modern web experiences within your Clomosy applications while maintaining control through the native component interface.

Information: Integrated Web Rendering
The TclProWebBrowser component enables loading of remote or local HTML content, executing JavaScript code, and managing browser history within Clomosy UI forms.
Example: ProWebBrowser.Navigate('https://cms.clomosy.com')
Feature Use of Definition
TclProWebBrowser ProWebBrowser : TclProWebBrowser; A variable belonging to the TclProWebBrowser class is created.
AddNewProWebBrowser ProWebBrowser = MyForm.AddNewProWebBrowser(MyForm, 'ProWebBrowser'); A new Pro Web Browser component is added to the form.
Navigate ProWebBrowser.Navigate('https://cms.clomosy.com'); Loads a web page from the specified URL into the browser.
LoadHTML ProWebBrowser.LoadHTML('<h1>Hello World</h1>'); Loads and renders raw HTML content directly without requiring a remote source.
LoadFile ProWebBrowser.LoadFile('path/to/localfile.html'); Opens and displays a local HTML file from the device storage.
ExecuteJavaScriptSync ProWebBrowser.ExecuteJavaScriptSync('alert(Hi!)'); Executes a JavaScript command synchronously within the loaded page context.
Reload ProWebBrowser.Reload; Reloads the current web page content.
GoBack ProWebBrowser.GoBack; Navigates to the previous page in the browser history.
GoForward ProWebBrowser.GoForward; Navigates to the next page in the browser history.
ClearCache ProWebBrowser.ClearCache; Clears the browser cache to ensure fresh content loading.
ShowDebugConsole ProWebBrowser.ShowDebugConsole; Opens the browser’s built-in developer tools console for debugging.
UserAgent ProWebBrowser.UserAgent = 'Mozilla/5.0...'; Allows customizing the browser’s user-agent string for compatibility testing.
AutoClearCache ProWebBrowser.AutoClearCache = True; Automatically clears cache on new page loads.
Url ProWebBrowser.Url = 'https://example.com'; Specifies or retrieves the currently loaded URL.
Important: JavaScript Execution Context
Use ExecuteJavaScriptSync for immediate script evaluation and UI updates.

For non-blocking operations, asynchronous execution may be preferred in performance-critical workflows.

Important Notes

  • TCLProWebBrowser supports both local and remote HTML sources.
  • ExecuteJavaScriptSync blocks until the command is executed; avoid heavy scripts in UI threads.
  • When debugging, use ShowDebugConsole to inspect DOM and JavaScript logs.
  • For performance, enable AutoClearCache only when necessary.
  • Always ensure valid HTTPS URLs for secure web content.

Example: TCLProWebBrowser in Use

var
  MyForm: TCLForm;
  ConnectBtn,ReloadBtn: TCLButton;
  ProWebBrowser: TCLProWebBrowser;

void ConnectBtnOnClick;
{
  ProWebBrowser.Url = 'https://docs.clomosy.com';

  //load custom HTML dynamically
  //ProWebBrowser.LoadHTML('<h1 style="color:#ff00ff">Hello World</h1>');

  
  // You can also use:
  // ProWebBrowser.GoBack;
  // ProWebBrowser.ClearCache;
  
}

void ReloadBtnOnClick;
{
  ProWebBrowser.Reload;
}

{
  MyForm = TCLForm.Create(Self);

  // Add a test button
  ConnectBtn = MyForm.AddNewButton(MyForm, 'ConnectBtn', 'Connect');
  ConnectBtn.Align = alTop;
  MyForm.AddNewEvent(ConnectBtn, tbeOnClick, 'ConnectBtnOnClick');

  ReloadBtn = MyForm.AddNewButton(MyForm, 'ReloadBtn', 'Reload');
  ReloadBtn.Align = alTop;
  MyForm.AddNewEvent(ReloadBtn, tbeOnClick, 'ReloadBtnOnClick');
  
  // Add a web browser
  ProWebBrowser = MyForm.AddNewProWebBrowser(MyForm, 'ProWebBrowser');
  ProWebBrowser.Align = alClient;
  ProWebBrowser.Margins.Top = 25;
  ProWebBrowser.Margins.Left = 25;
  ProWebBrowser.Margins.Right = 25;
  ProWebBrowser.Margins.Bottom = 25;

  MyForm.Run;
}

Output:

ProWebBrowser.png

See Also