728x90
VB.NET - WebBrowser 메시지 창 제어
(blog.naver.com/lsc980109/220967886886 소스 참고하였음)
소스
Private Sub Inject_Alert_Blocker()
Dim head As HtmlElement = WebBrowser1.Document.GetElementsByTagName("head")(0)
Dim script_element As HtmlElement = WebBrowser1.Document.CreateElement("script")
Dim alert_blocker As String = "###"
script_element.SetAttribute("text", alert_blocker)
head.AppendChild(script_element)
End Sub
Private Sub WebBrowser1_Navigated(sender As Object, e As WebBrowserNavigatedEventArgs) Handles WebBrowser1.Navigated
Inject_Alert_Blocker()
End Sub
Dim alert_blocker As String = "###"
### 소스
1. "window.confirm=function(){return true;}"
2. "window.alert=function(){return true;}"
3. "window.close=function(){}"
return 값 : true = 확인, false = 취소
비주얼베이직 6.0 소스
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
WebBrowser1.Document.parentWindow.execScript "window.confirm=function(){return true;}", "JavaScript"
WebBrowser1.Document.parentWindow.execScript "window.alert=function(){return true}", "JavaScript"
WebBrowser1.Document.parentWindow.execScript "window.close=function(){}", "JavaScript"
End Sub
'VB.NET' 카테고리의 다른 글
NateOn_TeamRoom_API_CURL_POST_HttpWebRequest (0) | 2022.07.22 |
---|---|
VB.NET - ImageSearchDLL.dll 이미지서치 (0) | 2021.05.12 |
VB.net - 디시 댓글 클리너 (0) | 2021.05.11 |
VB.net - WebBrowser의 Button 클릭하기 (0) | 2021.05.10 |