Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer

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.

share|improve this answer
Isn't there a way to achieve that by hosting a hidden browser in the app? – Vincent-Philippe Lauzon Apr 23 at 14:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.