C_WebView
High-level API for creating and managing native browser windows
Status
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.2CreateWithoutDevTools
Creates a native WebView window, with developer tools disabled. Has no effect if called multiple times.
Available since: v0.0.2EvaluateScript
Sends the encoded JavaScript program jsCodeString
to the native browser engine for (asynchronous) evaluation.
Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
jsCodeString | string |
IsRunning
Returns true
if a native WebView window has previously been created, and false
otherwise.
Return values | ||
---|---|---|
# | Name | Type |
isRunning | boolean |
NavigateToURL
Instructs the native browser engine to (asynchronously) navigate to the given url
. The browser may fetch additional resources.
Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
url | string |
SetAppIcon
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.2Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
appIconPath | string |
SetHTML
Instructs the native browser engine to (asynchronously) load the given htmlString
. The browser may not fetch additional resources.
Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
htmlString | string |
SetOnLoadScript
Instructs the native browser engine to inject and execute the given jsCodeString
on page load. You can't easily unset this currently.
Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
jsCodeString | string |
SetWindowSize
Resizes the native window that the WebView is running in. The exact behavior is platform-specific.
Available since: v0.0.2Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
newWidthInPixels | number | ||
newHeightInPixels | number |
SetWindowTitle
Updates the title
of the native window that the WebView is running in. The exact behavior is platform-specific.
Arguments | |||
---|---|---|---|
# | Name | Type | Fallback |
newWindowTitle | string |
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.2Changelog
Version | What happened? |
---|---|
v0.0.2 | Initial release |