I have a C#/WPF application with an embedded browser (WebBrowser) with some JavaScript. How can they communicate with each other in both directions? Is it practicable to use the URL?
JS->WPF: Listen for changes.
WPF->JS: Change the URL to javascript:alert('hello');
Is there a better way?
Can WPF be targeted to Web browser? WPF only runs on Windows. It doesn't run on Mac OS, it doesn't run on Chromebooks, and it doesn't run on mobile devices. WPF requires deployment and installation, it cannot be easily integrated in an intranet, and it doesn't run inside the web browser.
You cannot use Javascript to create a WPF application. WPF is a desktop application technology and Javascript are web technologies. WPF has C# in the background (or VB.NET). You can do events, actions, etc.
If you want to convert your WPF app to ASP.NET Web forms or MVC you would have to do it manually.To make it easier you could create shared code which can be used by both WPF and the web application. Thanks for your reply.In our WPF project we have used MVC pattern.
It's important to know that there are two WebBrowser. One for Windows Forms and one for WPF. The link below uses the WPF one. http://www.dotnetfunda.com/articles/article840-working-with-webbrowser-in-wpf.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With