1

HTML of the page is

 <html>
    <head>
        <title>This is Title</title>
    </head>
    <body>
        <button  value="Hello World" onclick="test()"  style="width: 171px; height: 77px"></button>
    </body>
</html>
<script>
    function test() {
        window.close();
    }
</script>

WPF code is

BrowserWindow1.Navigate(TextBox1.Text)

When I click on the button on the browser. Browser control gives me this message

The web page you are viewing is trying to close the tab. Do you want to close this tab?

I want to handle this thing before prompting this message and after prompting this message and thus override the default functionality of browser control with mine functionality.

4

1 回答 1

1

尝试WindowClosing在底层WebBrowserActiveX 控件上处理事件(这里是如何使用 WPF 版本获取它WebBrowser)。如果这不起作用,请检查这个

于 2013-11-06T20:54:19.853 回答