我正在使用Visual Studio C#2010的Web瀏覽器。c#Web瀏覽器保持凍結,但常規的IE9瀏覽器不會
web瀏覽器1導航到這個鏈接:
當它到達的頁面,它加載和凍結。
我不認爲網頁有什麼問題,因爲chrome,firefox和常規IE9根本不會凍結。
只有我的c#程序中的Web瀏覽器在導航到此鏈接時會凍結。
如何防止凍結?該網頁似乎是從另一個網站調用一些html數據。
我試圖將此代碼添加到我的程序
this.webBrowser1.ScriptErrorsSuppressed = TRUE;
我還更改了網絡瀏覽器的註冊表值,以便它將使用Internet Explorer版本9,到目前爲止,這兩個都不起作用。
這是我使用
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
webBrowser1.ScriptErrorsSuppressed = true;
}
private void button1_Click(object sender, EventArgs e)
{
webBrowser1.Navigate("http://www.costco.com/IOGEAR-Wireless-1080p-HDMI-Transmitter-and-Receiver-3D-Compatible-2x-HDMI-Ports.product.100011675.html");
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
}
}
}
分享你的代碼 – Arshad
好吧,我分享了它 –
您可能會檢查WebBrowser控件是否實際使用IE瀏覽器相同版本的您的Internet Explorer是。 (聽起來很奇怪,但忍受着我。)使用它們訪問可以檢測瀏覽器版本的頁面(例如http://www.whatismybrowser.com/)。這可能是因爲webbrowser控件使用的是舊版本的IE ......您可以在註冊表中修改它。看到這裏:http://stackoverflow.com/questions/5531452/webbrowser-control-to-use-ie9和在這裏:http://stackoverflow.com/questions/4612255/regarding-ie9-webbrowser-control – GojiraDeMonstah