1

Here is a use case. I need to:

  • Invoke JavaScript from .NET (C#) code
  • JavaScript won't be compile, it comes from a dynamic source
  • I need to pass .NET objects to that javascript code, preferable a dynamic object
  • I also need to receive objects back from this javascript code
  • I need this code to run in WPF (Windows 7) & Windows Store (WinRT)

So far I've only seen activation of Windows Script Engines (i.e. IActiveScript) or using open source project.

I would prefer to stay clear of Open Source project and would prefer to use IE JavaScript engine (Chakra). Windows Script Engine doesn't seems to work on WinRT. I can live with hosting a browser in my app as it is a UI app.

Code doesn't need to be identical in WPF & WinRT (I can write something to wrap the two implementation behind an common interface).

How can I do that?

1 Answer 1

1

Chakra does not expose a public hosting interface, so you won't be able to do what you want without hosting something like V8 inside your application.

Another option for the metro app would be to build the main app in JavaScript and call out to WinRT objects written in .NET for the majority of the work. Won't help you in WPF though.

Sign up to request clarification or add additional context in comments.

1 Comment

Isn't there a way to achieve that by hosting a hidden browser in the app?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.