mobileFX WebKitX ActiveX
Advanced Topics / Behavior Configuration
In This Topic
    Behavior Configuration
    In This Topic

    Enabling JavaScript

    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 Eval, AddScript, AddCode and ExecuteCommand methods, even if DownloadScripts is false. The key difference is download-time and run-time JavaScript execution and WebKitX DownloadScripts parameter controls download-time JavaScript and not run-time JavaScript.


    Setting HTML5 by code at Runtime

    WebKitX offers your two ways to load HTML: either by WebKitX.Open() method or by WebKitX.HTML property. Please note that providing a URL is recommended for successfully downloading relative resources such as Images, Style Sheets, Scripts, etc. If however you need to use the WebKitX.HTML property you first need to set a fake-but-valid URL and BaseURL. Chromium Embedded Framework Browser requires a valid URL page before you can inject HTML and/or JavaScript by code at run-time. To do so please use the WebKitX.URL and WebKitX.BaseURL properties before you use the WebKitX.HTML property.



    Disabling GPU

    In WebKitX GPU Hardware Acceleration is enabled by default. However, there are cases that you might need to host your application in a Virtualized environment such as VMware, Citrix or Virtual Box where GPU emulation is not available. You may disable GPU by handling the OnCreate() event and adding --disable-gpu --disable-webgl --disable-3d-apis --disable-gpu-compositing in CommandLineSwitches and setting Settings.webgl = False.




    Setting CEF3 Preferences at Runtime

    WebKitX offers GetPreference() and SetPreference() methods to read / modify CEF3 preferences at run-time. Please note that setting preferences causes CEF browser to recreate and it is time-costly, so use it with caution, especially when synchronizing WebKitX HTML with a Code Editor (like HTML5 Pad does). For example to enable / disable Spell Checking, WebKitX uses an internal Boolean latch in order to avoid browser recreation and you should use WebKitX1.SpellChecking = true instead of SetPreference("browser.enable_spellchecking", "true").

    For a list of preference please have a look here:



    See Also