Winforms Host Javascript Content
Is it possible to host and run advanced javascript, such as this, directly on a WinForms application? To be ultra-clear, when I say, directly, I mean that I cannot use a web sever
Solution 1:
Can you use an embeded html file and load that into a browser control?
Sample HTML:
<!DOCTYPE HTMLPUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><title></title><scripttype="text/javascript">alert("hello");
</script></head><body>
TESTING!
</body></html>
I named this file alertTest.html. It's properties are:
Build Action:ContentCopy to Output Directory:CopyalwaysFileName:alertTest.html
Then C# form:
publicForm1()
{
InitializeComponent();
StreamReader reader = new StreamReader("alertTest.html");
string html = reader.ReadToEnd();
this.webBrowser1.DocumentText = html;
}
this will produce an alert box and the word TESTING! on the windows form.
Post a Comment for "Winforms Host Javascript Content"