How to force Web Browser control to always open web page in the same window?

后端 未结 4 1375
梦毁少年i
梦毁少年i 2020-12-31 14:54

I need to use web browser in my application as it keeps repetitive tasks from employees, but there is a problem with javascript that opens a new window in IE after clicking

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-31 15:33

    Why such a complex answer Guys? Abatischev, I'd be curious to see into your brain, should be interesting...

    Just try this:

    Private Sub WB1_NewWindow(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles WB1.NewWindow
        newUrl = WB1.Url.ToString
    
        e.Cancel = True
        WB1.Navigate(newUrl)
    End Sub
    

    Now you may change the second line into WB2 or any other WebBrowser component in any of your OWN forms.

提交回复
热议问题