mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / OnLoadEnd Event
In This Topic
    OnLoadEnd Event
    In This Topic

    Fired when the browser is done loading a frame. Multiple frames may be loading at the same time. Sub-frames may start or continue loading after the main frame load has ended. 

    Visual Basic
    Public Event OnLoadEnd()

    OnLoadEnd event is fired when network-wise a frame has been downloaded but it might not be parsed and rendered yet. At this point you can enable HTML5 Editing or Preview (Browsing) and set the HTML DOM events you want WebKitX to subclass for every HTML Element on the document. After you receive this event you can start using the Selection and Formatting APIs.


    Handle this event to insert your custom scripts into the page by calling AddCode.

    This method will not be called for same page navigations (fragments, history state, etc.) or for navigations that fail or are canceled before commit.

    For notification of overall browser load status use OnLoadingStateChange instead.

    Loading Sequence

    Loading Sequence

    WebKitX provides several Events during its initialization, creation of the browser and loading of a URL. First you need to set the licensing information by handling the early Form Loading or Creation event. Then you can control CEF Browser creation by handling the OnCreate event. Once the browser is ready it will emit the the OnBrowserReady event where you can enable JavaScript or HTML5 editing parameters. In OnBrowserReady you should also load the HTML5 markup or navigate to the URL you want to load.

    During loading WebKitX will fire several loading events such as OnLoadStart and OnLoadEnd. If you are loading HTML with frames (IFRAMEs) then some events will fire multiple times, such as OnPageLoadStart and OnPageLoadEnd. When the main frame is loaded WebKitX will fire OnLoadEnd and when all frames have loaded WebKitX will fire the OnPageComplete event.

    When you receive the OnLoadEnd and OnPageLoadEnd events, it means that network-wise the contents have downloaded but HTML-wise the contents might not be fully parsed yet. In HTML terms this means that document.readyState value might not not set to complete. Pages in window or sub frames might be in interactive state and resources might be loading in the background. The only event that guarantees that the main window frame and all sub-frames have document.readyState = complete is OnPageComplete.

    Internally, WebKitX uses an asynchronous task that checks the document.readyState for all frames; if this check result is "complete" with a count equal to browser frames, then the event is fired. If some frames have loaded while other frames have failed, the event will not fire. The check takes place on a fresh HTML DOM snapshot obtained every time at the moment of the check, and examines the current number of frames. The frames must remain unchanged for 3 seconds before the event is fired; this way, any dynamic loading or unloading of frames is taken into account.

    Please note that some frameworks such as Angular and React dynamically load portions of the page. WebKitX events will keep firing while dynamic content is downloaded. You need to examine the behavior of the control in relation with the web site you want to display and adjust your event handling accordingly.

    Private Sub WebKitX1_OnLoadEnd()
        On Error Resume Next
        Debug.Print "WebKitX1_OnLoadEnd"
        AddLog "WebKitX1_OnLoadEnd: " + WebKitX1.URL
        ' Control Edit or Preview
        If mnuEditable.Checked Then
            WebKitX1.Modified = False
        End If
        ' Hook an certail HTML DOM Events
        If EditMode = EDIT_SOURCE Then Exit Sub
        Timer1.Enabled = False
    End Sub
    private void WebKitXCEF31_OnLoadEnd(object sender, EventArgs e)
        AddLog("WebKitX1_OnLoadEnd: " + WebKitXCEF31.URL);
        if (menuItemEnableHTMLEditing.Checked)
            WebKitXCEF31.Modified = false;
        if (EditMode != EDIT_MODE.EDIT_SOURCE)
            timer1.Enabled = false;
            timer1_Tick(sender, e);
    See Also