Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Sir,
how to run java script in winform application?
Can you give me an example please?
Posted
Updated 13-Nov-10 22:17pm
v2

Why would you want to?
Javascript is a language for running in a web browser, so you could run it in a WebBrowser control if you really had to. But why? Why make life more complicated for yourself - everything you can do in javascript, you can do in C# in WinForms without the hassle of a WebBrowser control.
What are you trying to do that need this?
 
Share this answer
 
Comments
nagababu maridu 14-Nov-10 6:06am    
thank u sir
Joezer BH 12-Feb-13 3:26am    
There can be many reasons for doing such a thing!
An example would be an application that automatically performs actions on behalf of a user, that would require you send a series of HTTP requests, get the responses and perform an operation that includes several interactions with the server. In every operation you may be required to do stuff using JS as it is a HTTP result best handled with the WebBrowser control.
Hi,
you can run JavaScript from your winforms application only if javascript is in page loaded by webbrowser control. here is an example:
http://www.west-wind.com/Weblog/posts/493536.asp[^]
http://notions.okuda.ca/2009/06/11/calling-javascript-in-a-webbrowser-control-from-c[^]
Regards
Robert
 
Share this answer
 
Comments
nagababu maridu 14-Nov-10 6:05am    
thank u sir
Kanasz Robert 14-Nov-10 12:03pm    
you are welcome ... I hope it was helpful.
Hi again.
here is a tip/trick:
Calling JavaScript function from WinForms and vice-versa[^]
Regards
Robert
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900