0

I am using the WinForms WebBrowser control in my C# application and I can interact with the JS code on the web page by setting a COM class in the ObjectForScripting property of the control.

Is it possible to get the JavaScriptContext object from the web browser control that I can use with the ChakraCore API?

A9S6
  • 6,125
  • 10
  • 48
  • 81

1 Answers1

1

No sir, ChakraCore is part of the Microsoft Edge JavaScript engine. It is literally a separate engine. The web browser control uses IE's engine. Although admittedly it doesn't help that the dev team at MS called The MS Edge Engine Chakra when they were calling the engine from IE 9 forward as Chakra also.

Anyway if you want to use/embed the ChakraCore engine from C# they did create a getting started page. I will link it here.

The API for the winforms Webbrowser control Engine is here. The is a wrapper around the COM API. If you need to get to the COM api to do advanced things, you will need MSHTML, which you add as a COM reference to Microsoft Html Object library. The reference for MSHTML is here.

Alexander Ryan Baggett
  • 2,170
  • 4
  • 28
  • 55
  • Its quite confusing to follow what MS has done. Chakra(JScript) was used in IE9-11 and then ChakraCore was forked from original Chakra and it become the JavaScript engine for IE Edge. The web browser control uses IE 9 - 11 I guess so it used the *old* Chakra engine. Is there an API for that old Chakra? https://en.wikipedia.org/wiki/List_of_ECMAScript_engines – A9S6 Dec 11 '17 at 06:59