Platforms to show: All Mac Windows Linux Cross-Platform

Next items

WebView2ControlMBS.AddScriptToExecuteOnDocumentCreatedCompleted(JavaScript as String, ErrorCode as Integer, ID as String, Tag as Variant)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report that AddScriptToExecuteOnDocumentCreated is done and provide the ID.
WebView2ControlMBS.CapturePreviewCompleted(ImageFormat as Integer, ErrorCode as Integer, PictureData as String)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called when CapturePreview call is done.
Notes:
We pass you the image data as a string, so you can e.g. write it to a PNG or JPEG file.
Otherwise ErrorCode tells you the reason for the error.
WebView2ControlMBS.Close
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function:
The control is about to close.
In Xojo version 2021r3 and newer this event is named Closing.
WebView2ControlMBS.Closing
Type Topic Version
event WebView2 20.5
Function:
The control is about to close.
In older Xojo versions, this event is named Close.
WebView2ControlMBS.Configure
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called while initializing, where you can apply properties just before plugin reads them.
WebView2ControlMBS.ConstructContextualMenu(base as MenuItem, x as Integer, y as Integer) as Boolean
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 22.1 ❌ No ✅ Yes ❌ No ❌ No
Function: This event is called when it is appropriate to display a contextual menu for the control.
WebView2ControlMBS.ContainsFullScreenElementChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: ContainsFullScreenElementChanged fires when the ContainsFullScreenElement property changes.
Notes: This means that an HTML element inside the WebView is entering fullscreen to the size of the WebView or leaving fullscreen. This event is useful when, for example, a video element requests to go fullscreen. The listener of ContainsFullScreenElementChanged can then resize the WebView in response.
WebView2ControlMBS.ContentLoading(isErrorPage as Boolean, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The content loading event.d
Notes: ContentLoading fires before any content is loaded, including scripts added with AddScriptToExecuteOnDocumentCreated. ContentLoading will not fire if a same page navigation occurs (such as through fragment navigations or history.pushState navigations). This follows the NavigationStarting and SourceChanged events and precedes the HistoryChanged and NavigationCompleted events.
WebView2ControlMBS.ContextualMenuAction(hitItem as MenuItem) as Boolean
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 22.1 ❌ No ✅ Yes ❌ No ❌ No
Function: Called when a menuitem is choosen.
Notes: This allows the control to react on its relevant menu items. Please return true if you handled it or false to give others a chance.
WebView2ControlMBS.DocumentTitleChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report a document title change.
Notes: DocumentTitleChanged fires when the DocumentTitle property of the WebView changes and may fire before or after the NavigationCompleted event.
WebView2ControlMBS.EnableMenuItems
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 22.1 ❌ No ✅ Yes ❌ No ❌ No
Function:
The event where you can enable menu items.
In Xojo version 2021r3 and newer this event is named MenuBarSelected.
WebView2ControlMBS.ExecuteScriptCompleted(JavaScript as String, ErrorCode as Integer, resultObjectAsJson as String, Tag as Variant)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report ExecuteScript method is done.
WebView2ControlMBS.FocusLost
Type Topic Version
event WebView2 20.5
Function:
LostFocus fires when WebView lost focus.
In older Xojo versions, this event is named LostFocus.
Notes: In the case where MoveFocusRequested event is fired, the focus is still on WebView when MoveFocusRequested event fires. LostFocus only fires afterwards when app's code or default action of MoveFocusRequested event set focus away from WebView.
WebView2ControlMBS.FocusReceived
Type Topic Version
event WebView2 20.5
Function:
GotFocus fires when WebView got focus.
In older Xojo versions, this event is named GotFocus.
WebView2ControlMBS.FrameNavigationCompleted(isSuccess as Boolean, ErrorStatus as Integer, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: FrameNavigationCompleted fires when a child frame has completely loaded (body.onload has fired) or loading stopped with error.
WebView2ControlMBS.FrameNavigationStarting(URL as String, IsUserInitiated as Boolean, IsRedirected as Boolean, NavigationID as UInt64) as Boolean
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: FrameNavigationStarting fires when a child frame in the WebView requests permission to navigate to a different URI. This will fire for redirects as well.
Notes:
Corresponding navigations can be blocked until the event handler returns.
Return true to block the request.
WebView2ControlMBS.GotFocus
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function:
GotFocus fires when WebView got focus.
In Xojo version 2021r3 and newer this event is named FocusReceived.
WebView2ControlMBS.HistoryChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report history change.
Notes: HistoryChanged listens to the change of navigation history for the top level document. Use HistoryChanged to check if CanGoBack/CanGoForward value has changed. HistoryChanged also fires for using GoBack/GoForward. HistoryChanged fires after SourceChanged and ContentLoading.
WebView2ControlMBS.LostFocus
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function:
LostFocus fires when WebView lost focus.
In Xojo version 2021r3 and newer this event is named FocusLost.
Notes: In the case where MoveFocusRequested event is fired, the focus is still on WebView when MoveFocusRequested event fires. LostFocus only fires afterwards when app's code or default action of MoveFocusRequested event set focus away from WebView.
WebView2ControlMBS.MenuBarSelected
Type Topic Version
event WebView2 22.1
Function:
The event where you can enable menu items.
In older Xojo versions, this event is named EnableMenuItems.
WebView2ControlMBS.NavigationCompleted(isSuccess as Boolean, ErrorStatus as Integer, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report a navigation action completed.
Notes: NavigationCompleted fires when the WebView has completely loaded (body.onload has fired) or loading stopped with error.
WebView2ControlMBS.NavigationStarting(URL as String, IsUserInitiated as Boolean, IsRedirected as Boolean, NavigationID as UInt64) as Boolean
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report a navigation action.
Notes:
NavigationStarting fires when the WebView main frame is requesting permission to navigate to a different URI. This will fire for redirects as well.
Corresponding navigations can be blocked until the event handler returns.

Return true to cancel it like Xojo's CancelLoad event.

This event is great to check the URL. If you like to block it, you may just return true. If the user initiated the request, you may instead want to load a warning page. Also check the URL and decide whether to turn scripting on or off.
WebView2ControlMBS.NewWindowRequested(URL as String, IsUserInitiated as Boolean, WindowFeatures as WebView2WindowFeaturesMBS, byref NewWindow as Variant) as Boolean
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called when a new window needs to be opened.
Notes:
Return true to indicate you handled the event.
If you create a new window with a WebView2ControlMBS (or DesktopWebView2ControlMBS), you can put it in NewWindow property.

IsUserInitiated:
True when the new window request was initiated through a user gesture.

Examples of user initiated requests are:
Selecting an anchor tag with target
Programmatic window open from a script that directly run as a result of user interaction such as via onclick handlers.
Non-user initiated requests are programmatic window opens from a script that are not directly triggered by user interaction, such as those that run while loading a new page or via timers. The Microsoft Edge popup blocker is disabled for WebView so the app is able to use this flag to block non-user initiated popups.

URL: The target uri of the new window requested.

NewWindow: Set the new control to use.

If the NewWindow is set, the top-level window returns as the opened WindowProxy. The NewWindow property should be set to a control that has not been navigated previously. Don't use methods that cause navigation or interact with the DOM on this web view. Setting event handlers, changing Settings properties, or other methods are fine to call. Changes to settings should be made before NewWindow is called to ensure that those settings take effect for the newly setup WebView. Once the NewWindow is set the underlying web contents of this CoreWebView2 will be replaced and navigated as appropriate for the new window. After setting new window it cannot be changed and error will be return otherwise.
WebView2ControlMBS.Open
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function:
The control is about to was created and you can initialize it.
In Xojo version 2021r3 and newer this event is named Opening.
WebView2ControlMBS.Opened
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called when browser initialization is done.
Notes:
Typical event flow is like this:

  • Configure
  • Open
  • Window.Open
  • Opened

Opened is called a few milliseconds later.

If you load an URL, the events happen like this:

  • NavigationStarting
  • SourceChanged
  • ContentLoading
  • HistoryChanged
  • DocumentTitleChanged
  • NavigationCompleted
WebView2ControlMBS.Opening
Type Topic Version
event WebView2 20.5
Function:
The control is about to was created and you can initialize it.
In older Xojo versions, this event is named Open.
WebView2ControlMBS.PermissionRequested(URL as String, PermissionKind as Integer, IsUserInitiated as Boolean, byref State as Integer)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to query permissions from user.
Notes:
PermissionRequested fires when content in a WebView requests permission to access some privileged resources.
If a deferral is not taken on the event args, the subsequent scripts can be blocked until the event handler returns. If a deferral is taken, then the scripts are blocked until the deferral is completed.

URL: The origin of the web content that requests the permission.
PermissionKind: The type of the permission that is requested.
IsUserInitiated: True when the permission request was initiated through a user gesture.
State: The status of a permission request, i.e.

Please assign State the answer you like to provide.
WebView2ControlMBS.ProcessFailed(processFailedKind as Integer)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: ProcessFailed fires when a WebView process is terminated unexpectedly or becomes unresponsive.
WebView2ControlMBS.SourceChanged(isNewDocument as Boolean)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 20.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report a change in the URL.
Notes: SourceChanged fires when the Source property changes. SourceChanged fires for navigating to a different site or fragment navigations. It will not fire for other types of navigations such as page reloads or history.pushState with the same URL as the current page. SourceChanged fires before ContentLoading for navigation to a new document.

Next items

The items on this page are in the following plugins: MBS WinFrameworks Plugin.

Feedback: Report problem or ask question.

The biggest plugin in space...


Start Chat