mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / DownloadScripts Property
In This Topic
    DownloadScripts Property
    In This Topic
    Description

    This master flag enables or disables JavaScript.

    Property type
    Read-write property
    Syntax
    Visual Basic
    Public Property DownloadScripts As Boolean
    Return Type

    Returns current property value.

    Remarks

    Please note that in WebKitX downloading script tags is disabled by default because in editor mode JavaScript execution often messes with HTML5 styles, especially if you are using features such as Parallax Scrolling and JavaScript-aided responsive layouts. If you want to download and execute JavaScript you must explicitly enable it using  WebKitX1.DownloadScripts = True in OnBrowserReady event handler, as illustrated in code fragment below.

    As a side note, in editor mode of WebKitX you can execute JavaScript at run-time using EvalAddScriptAddCode and ExecuteCommand methods, even if DownloadScripts is false.

     The key difference is download-time and run-time JavaScript execution.

    WebKitX DownloadScripts parameter controls download-time JavaScript and not run-time JavaScript.

    Example
    Private Sub WebKitX1_OnBrowserReady()
        
        On Error Resume Next
        
        ' Restore focus to WebKitX after a command is executed (form a menu or context menu)
        WebKitX1.ExecCommandSetFocus = True
        
        ' Enable mobileFX formatting vs. CEF3 formatting (Recommended)
        WebKitX1.FormatUsingInternalSelectionAPI = True
        
        ' Allow JavaScript download (sometimes scripts such as parallax mess with HTML5 styles)
        WebKitX1.DownloadScripts = False
        mnuDownloadScripts.Checked = False
        
        ' Initial HTML to show (optional)
        
        If LoadFile <> "" Then
            WebKitX1.Open LoadFile
            LoadFile = ""
        Else
            WebKitX1.HTML = "<html><body></body></html>"
        End If
        
        'WebKitX1.Open "file:///my_path/index.html"
        
    End Sub
    private void WebKitXCEF31_OnBrowserReady(object sender, EventArgs e)
    {
        WebKitXCEF31.ExecCommandSetFocus = true;
        WebKitXCEF31.FormatUsingInternalSelectionAPI = true;
        WebKitXCEF31.DownloadScripts = false;
        menuItemDownloadScript.Checked = false;
        if (LoadFile != "")
        {
            WebKitXCEF31.Open(LoadFile);
            LoadFile = "";
        }
        else
        {
            WebKitXCEF31.HTML = "<html><body></body></html>";
        }
    }
    See Also