4

Is there anyway to call a JavaScript function from .NET Compact Framework through the WebBrowser control?

1
  • Are you able to achieve, vice-versa. Is it possible to call C# method from Javascript in .NET CF ( ObjectForScripting doesn't exist for .NET CF)? Commented Jun 4, 2012 at 5:25

1 Answer 1

4

It works with the Navigate() Method. I just tried it with the Windows Mobile 5.0 Pocket PC Emulator.

For example:

webBrowser1.DocumentText = @"<html><head>
            <script type='text/javascript'>
                function doIt() {
                    alert('hello again');
                    return 'i did it!';
                }
            </script>
            </head><body>hello!</body></html>";
webBrowser1.Navigate(new Uri("javascript:doIt()"));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.