views:

17

answers:

1

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

+1  A: 

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()"));
Stefan Pühringer