Call JavaScript function from .NET Compact Framework in WebBrowser control

╄→гoц情女王★ 提交于 2019-12-07 11:08:54

问题


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


回答1:


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()"));


来源:https://stackoverflow.com/questions/3135586/call-javascript-function-from-net-compact-framework-in-webbrowser-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!