Search code examples
javascriptc#windows-runtimechakra

How to execute Javascript code in a WinRT C# application?


I am writing a WinRT application in C#.

I would like to execute some Javascript code. An entire WebView is not needed in my case, I just need to interface with a Javascript virtual machine. The C# code would call Javascript functions and would export some objects to the Javascript side.

I know there is JsRT, the C API of Chakra, the jsvm used by Internet Explorer. But JsRT, as far as I know, is not available to WinRT. Other virtual machines are not allowed under WinRT.

So, the question is: is it even possible to call Javascript code from C# code? If not, waiting for the release of JsRT for WinRT is the only option?


Solution

  • It's possible to call JavaScript from C# but not without a WebView control.