22년 6월 Internet Explorer가 지원 종료 되었지만 , 여전히 사용 가능하다.
: 호출 하고자 하는 웹 주소를 그대로 navigate로 호출
- GET방식
string url = www.google.com webbrowser.navigate(url)
- POST방식
string PostData = string.Format("param={0}¶m={1}", value, value); byte[] param = Encoding.UTF8.GetBytes(PostData); //바이트 형식으로 받은 다음 넣어주면 된다. webbrowser.navigate(url, "POST", param , "Content-Type: application/x-www-form-urlencoded")
: WebBrowser 컨트롤이 문서 로드를 완료할 때 발생합니다.
private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e)
{
//문서가 완전히 로드 되었는지 확인하는 것이 좋다.
if (this.wbReport.ReadyState == WebBrowserReadyState.Complete){
event();
}
}
: 현재 로드된 문서에 의해 구현되 스크립트 함수를 실행 (호출한 문서에 정의함 함수를 호출)
test.jsp
function showMsg(){ return "This is test"; }
main.cs
webbrowser.navigate(test.jsp); WebBrowserDocumentCompletedEventArgs e) { if (this.wbReport.ReadyState == WebBrowserReadyState.Complete){ var str = webbrowser.Documnet.InvokeScript("showMsg"); messagebox(str); } }결과 > "This is test"