Platforms to show: All Mac Windows Linux Cross-Platform

DesktopWebView2ControlMBS.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 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report that AddScriptToExecuteOnDocumentCreated is done and provide the ID.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.CapturePreviewCompleted(ImageFormat as Integer, ErrorCode as Integer, PictureData as String)
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 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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.Configure
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called while initializing, where you can apply properties just before plugin reads them.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.ContainsFullScreenElementChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.ContentLoading(isErrorPage as Boolean, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.DocumentTitleChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.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 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event to report ExecuteScript method is done.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.FocusLost
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: LostFocus fires when WebView lost focus.
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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.FocusReceived
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: GotFocus fires when WebView got focus.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.FrameNavigationCompleted(isSuccess as Boolean, ErrorStatus as Integer, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: FrameNavigationCompleted fires when a child frame has completely loaded (body.onload has fired) or loading stopped with error.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.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 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.HistoryChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.NavigationCompleted(isSuccess as Boolean, ErrorStatus as Integer, NavigationID as UInt64)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.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 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.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 DesktopWebView2ControlMBS (or DesktopDesktopWebView2ControlMBS), 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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.Opened
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 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

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.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 21.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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.ProcessFailed(processFailedKind as Integer)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: ProcessFailed fires when a WebView process is terminated unexpectedly or becomes unresponsive.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.SourceChanged(isNewDocument 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 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.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.WebMessageReceived(Source as String, webMessageAsJson as String, webMessageAsString as String)
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event called for a web message.
Notes:
WebMessageReceived fires when the IsWebMessageEnabled setting is set and the top level document of the WebView calls window.chrome.webview.postMessage. The postMessage function is void postMessage(object) where object is any object supported by JSON conversion.

webMessageAsString is empty if we can't serialize it to text.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.WindowCloseRequested
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: The event where JavaScript asks to close window.
Notes: WindowCloseRequested fires when content inside the WebView requested to close the window, such as after window.close is called. The app should close the WebView and related app window if that makes sense to the app.

Feedback, Comments & Corrections

DesktopWebView2ControlMBS.ZoomFactorChanged
Type Topic Plugin Version macOS Windows Linux iOS Targets
event WebView2 MBS WinFrameworks Plugin 21.5 ❌ No ✅ Yes ❌ No ❌ No
Function: ZoomFactorChanged fires when the ZoomFactor property of the WebView changes.
Notes: The event could fire because the caller modified the ZoomFactor property, or due to the user manually modifying the zoom. When it is modified by the caller via the ZoomFactor property, the internal zoom factor is updated immediately and there will be no ZoomFactorChanged event. WebView associates the last used zoom factor for each site. Therefore, it is possible for the zoom factor to change when navigating to a different page. When the zoom factor changes due to this, the ZoomFactorChanged event fires right after the ContentLoading event.

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS Xojo Plugins

Start Chat