

The methods runs a piece of JavaScript and return the result. Method EvaluateScript(script as string, sourceURL as string, StartLineNumber as Integer, byref JSException as string) as string Method EvaluateScript(script as string, sourceURL as string = "", StartLineNumber as Integer = 0) as string If you need more options, you can use the methods of LinuxJavaScriptContextMBS class instead. Method EvaluateScript(script as string) as string We got two methods there to run JavaScript:
#XOJO HTMLVIEWER ZOOM CODE#
But on a frame, we can use methods in ChromiumFrameMBS class to get the text or source code of the page, so if the result is put in the DOM, you may see it there.įor Linux, the MBS Xojo Plugins supports using WebKit for the HTMLViewer and has various extensions in the LinuxWebViewMBS class. Sadly the execution is asynchronously and we don't get back the result. For Chromium browser object, we got a method to run JavaScript:ĮxecuteJavaScript(jsCode as string, scriptUrl as string = "", startLine as Integer = 0) As Xojo already uses the third version of Chromium Embedded Framework (CEF), be sure to use recent plugins which support all three versions. ChromiumBrowserMBS function returns you such an object for a given HTMLViewer. We use that in a few examples projects.įor using WebKit in Xojo, we have the ChromiumBrowserMBS class. As you can create the field with a JavaScript, you can first run RunJavaScript to create it, than fill the field and call JavaScript with RunJavaScript to use it and put the result back into the text area. Methods to transfer large text blocks between JavaScript and Xojo. IESetTextAreaMBS(FormName as String, FieldName as String, Value as String) as Boolean IEGetTextAreaMBS(FormName as String, FieldName as String) as String You can use a hidden textarea form control on the website with our For that we convert the result to Xojo data types and put it in a variant. The first one doesn't provide a result, so we later added the Evaluate call to provide the result. IEDocumentMBS.Evaluate(expression as string) as variant IEWindowMBS.RunJavaScript(JavaScript as string) as boolean When using Internet Explorer, we can run JavaScript with You switch this by the Renderer property. First you can run it with Internet Explorer (native renderer) or with WebKit mode.
#XOJO HTMLVIEWER ZOOM WINDOWS#
We could implement a synchronous version, too.įor Windows the HTMLViewer can run in two modes. We translate data types from JavaScript for you, so passing a number back will give you a number wrapped in the variant. So when it finishes, this calls JavaScriptEvaluated event and passes the result as variant. We have a function there to evaluate JavaScript, which runs asynchronously:ĮvaluateJavaScript(JavaScript as String, Tag as String = "") On the other side WebKit 2 doesn't do printing well and all the controlling on the web viewer has to go from one process to the helper process running it. So only for 64-bit you benefit from newer JavaScript engine, running website in its own process and better security. If you put the WKWebViewControlMBS control on the window and for 32-bit, it will use the WebKit 1.x WebView class, while in a 64-bit application will use the newer WKWebView class.


Xojo doesn't use WebKit 2, but you can use our WKWebViewControlMBS control from the plugins. It's perfect to call JavaScript functions or to run a piece of JavaScript.Īlternatively you can get WebViewMBS object for the HTMLViewer and than call EvaluateJavaScript there directly. This is a convenient function for MacOS to evaluate some JavaScript and return the result synchronously. EvaluateJavaScriptMBS(code as string) as string As we started with MacOS support first many years ago, those are the oldest functions for HTMLViewer. So we have WebViewMBS class (WebKit 1.x), WKWebViewControlMBS control (WebKit 2.x), Internet Explorer classes like IEDocumentMBS and IEWebBrowserMBS, ChromiumBrowserMBS class for Chromium Embedded Framework and LinuxWebViewMBS class for WebKit on Linux.įirst we have our extensions to HTMLViewer class. Here a few details on the various ways to run JavaScript in the HTMLViewer in Xojo. HTMLViewer JavaScript communication for Xojo The MBS Xojo Plugins provide various functions for HTMLViewer to use JavaScript in Xojo applications.
