Skip to main content

C_WebView

High-level API for creating and managing native browser windows

Status

Experimental: Functionality may change for any reason, without semantic versioning guarantees

Availability

This is a global namespace and can be accessed directly:

C_WebView.CreateWithDevTools() -- Implicit global lookup: _G.C_WebView

Functions

CreateWithDevTools

Creates a native WebView window, with developer tools enabled. Has no effect if called multiple times.

Available since: v0.0.2

CreateWithoutDevTools

Creates a native WebView window, with developer tools disabled. Has no effect if called multiple times.

Available since: v0.0.2

EvaluateScript

Sends the encoded JavaScript program jsCodeString to the native browser engine for (asynchronous) evaluation.

Available since: v0.0.2
Arguments
#NameTypeFallback
jsCodeStringstring

IsRunning

Returns true if a native WebView window has previously been created, and false otherwise.

Available since: v0.0.2
Return values
#NameType
isRunningboolean

Instructs the native browser engine to (asynchronously) navigate to the given url. The browser may fetch additional resources.

Available since: v0.0.2
Arguments
#NameTypeFallback
urlstring

SetAppIcon

Blocking API
This operation is synchronous; it will prevent the event loop from running while the request is being handled.

Sets the application icon for the native window that the WebView is running in. Loading is handled by the underlying OS, but it's generally blocking. Additionally, you must ensure that the app icon is provided in a compatible format for each platform:

  • On Windows, icons must use the ICO format
  • Mac OS app icons use the Apple Icon Image format
  • On Linux, standard formats like JPG or PNG can be used (assuming a loader is present)

Depending on the OS and its version, the icon may appear in different locations (e.g., OSX Dock and Windows task bar).

Available since: v0.0.2
Arguments
#NameTypeFallback
appIconPathstring

SetHTML

Instructs the native browser engine to (asynchronously) load the given htmlString. The browser may not fetch additional resources.

Available since: v0.0.2
Arguments
#NameTypeFallback
htmlStringstring

SetOnLoadScript

Instructs the native browser engine to inject and execute the given jsCodeString on page load. You can't easily unset this currently.

Available since: v0.0.2
Arguments
#NameTypeFallback
jsCodeStringstring

SetWindowSize

Resizes the native window that the WebView is running in. The exact behavior is platform-specific.

Available since: v0.0.2
Arguments
#NameTypeFallback
newWidthInPixelsnumber
newHeightInPixelsnumber

SetWindowTitle

Updates the title of the native window that the WebView is running in. The exact behavior is platform-specific.

Available since: v0.0.2
Arguments
#NameTypeFallback
newWindowTitlestring

ToggleFullscreenMode

Sets windowed or fullscreen mode for the native window that the WebView is running in, based on its previous state.

Available since: v0.0.2

Changelog

VersionWhat happened?
v0.0.2Initial release