mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / AddCode Method

Typically this should be ECMA JavaScript code but if Harmony flags are enabled in OnCreate then you can also add ES6 JavaScript code to the control.

In This Topic
    AddCode Method
    In This Topic
    Description

    Adds code to the global JavaScript object of the currently loaded page.

    Syntax
    Visual Basic
    Public Sub AddCode( _
       ByVal javascript As String _
    ) 
    Parameters
    javascript

    Typically this should be ECMA JavaScript code but if Harmony flags are enabled in OnCreate then you can also add ES6 JavaScript code to the control.

    Remarks

    You must make sure that the HTML page has loaded, parsed and rendered successfully before you call this method.

    Example
    Private Sub mnuAddCode_Click()
        On Error Resume Next
        Dim s As String
        s = InputBox("JavaScript Code:", , "alert('test')")
        If s = "" Then Exit Sub
        WebKitX1.AddCode s
    End Sub
    private void menuItemAddCode_Click(object sender, EventArgs e)
    {
        string input = Microsoft.VisualBasic.Interaction.InputBox("JavaScript Code", "HTML5Pad", "alert('Test')", 500, 300);
        if (input != "")
        {
            WebKitXCEF31.AddCode(input);
        }
    }
    See Also