Problem solve Get help with specific problems with your technologies, process and projects.

Can JScript code call a C# function on a Web form?

I have a Windows Form with the Microsoft WebBrowser component. If I load an HTML file containing JScript, can my JScript code call a C# function on the form? Also, can C# call a JScript function in my HTML file?
There's an easy answer: NO WAY! But the truth is that there IS a way to get inside the MSHTML component (the one behind the Web browser). However, let me tell you it's FAR from trivial, requires significant COM interop code, implementing HIGHLY poorly or directly undocumented interfaces, etc. You're really asking for trouble.

The best advice I can give you is to take a look at Nikhil Kotari's page and perform a search for "MSHTML C# wrapper" in Google. You will find wrappers that will let you get HTML events handled in managed code (C#) and from there you can modify the DOM, etc.

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.