110,538
社区成员
发帖
与我相关
我的任务
分享
private void axWebBrowser1_DocumentComplete(object sender, AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
if (_ActiveWebBrowser.ReadyState == SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
HE_WebBrowserTag _HE_WebBrowserTag = (HE_WebBrowserTag)_ActiveWebBrowser.Tag;
if (_HE_WebBrowserTag._TabIndex == tabControl1.SelectedIndex)
{
txbURLLocation.Text = _ActiveWebBrowser.LocationURL;
}
WebBrowserViewSource();//获取网页源代码
}
}
using mshtml;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
textBox1.Text += "\r\n WB DCOM\r\n";
//webBrowser1.DocumentText = webBrowser1.DocumentText.Replace("window.open", "").Replace("window.Open", "");
IHTMLDocument2 vDo = (IHTMLDocument2)webBrowser1.Document.DomDocument;
// vDo.parentWindow.execScript("function alert(str){ window.external.HaHa(str); } var wnd=window; function window2() { this.win=wnd; this.open=function(url, target, params) { window.external.HaHa(url); }; this.unload=function() { window.external.HaHa('Out ing OK'); }; } var hjhj=new window2(); hjhj.open('http://www.baidu.com','haha','jiba'); alert('hahabubububu'); ", "javaScript");
vDo.parentWindow.execScript("function alert(str){ window.external.HaHa(str); } function window.open(url, target, params) { window.external.HaHaopen(url , target); }; function window.unload() { window.external.HaHaunld(); } ; function window.close() { window.external.HaHaclose(); } ; function window.onunload() { window.external.HaHaunld(); }; function window.onbeforeunload() { window.external.HaHaunld(); }; function cls(){ window.external.HaHaunld(); }; alert('hahabubububu'); ", "javaScript");
}
public void HaHa(string haha)
{
textBox1.Text += " \r\n ★★★★★★★★★★ \r\n==WB Get Message== \r\n " + haha + "\r\n";
}
public void HaHaopen(string url,string tager)
{
textBox2.Text += " \r\n ★★★★★★★★★★ \r\n==WB Get NewWind== \r\n URL:" + url+" TAG:"+tager+ "\r\n";
SBisDO = true;
if (url.ToLower().Substring(0, 4) == "/eip")
{
webBrowser2.Navigate("http://app.xxml.com.cn" + url,false);
}
}
public void HaHaclose()
{
textBox1.Text += " \r\n ★★★★★★★★★★ \r\n==WB Get close== \r\n \r\n";
}
public void HaHaunld()
{
textBox1.Text += " \r\n ★★★★★★★★★★ \r\n==WB Get UnLoading== \r\n \r\n";
}
private void webBrowser1_FileDownload(object sender, EventArgs e)
{
textBox1.Text += "WB is FILE DOWN \r\n";
}
private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
{
textBox1.Text += "WB is Naving "+e.Url.ToString() +" == "+e.TargetFrameName+"\r\n";
}
IHTMLDocument2 vDocument = (IHTMLDocument2)mybrowser.Document.DomDocument;
string s = @"function confirm() {";
s += @"return true;";
s += @"}";
s += @"function alert() {}";
vDocument.parentWindow.execScript(s, "javascript");