WebBrowser在特定网页上停止响应,但IE没有

时间:2011-05-12 17:09:23

标签: c# .net winforms webbrowser-control

如果您制作了WinForms应用并添加了WebBrowser控件并导航到此页面:

http://www.llrx.com/features/deepweb2010.htm

应用程序将停止响应。 IE,Chrome和Mozilla不会。任何想法“我做错了什么”?

2 个答案:

答案 0 :(得分:1)

他是对的。

            WebBrowser wb = new WebBrowser();
            wb.Parent = this;
            wb.Visible = true;
            wb.Navigate("C:\Test.html");

使用最小的html形式:

<!DOCTYPE html>
<html>

<head>
    <base href="http://www.llrx.com/" />
    <style type="text/css" media="all">@import "/themes/llrx/style.css"; #beta2fix a:hover {color: #000;}</style>
</head>
<body>

<div>
    <h1 id="logo"><a href="/">Test</a></h1>
</div>

</body>
</html>

如果我知道为什么(还),那该死的。

答案 1 :(得分:1)

下面的CSS线条吓坏了:

/* MSIE PC */
#logo a { background-image: expression(this.runtimeStyle.backgroundImage = "none", this.innerHTML = '<img src="http://www.llrx.com/themes/llrx/images/logo.gif" border="0" alt="' + this.innerHTML + '">'); }
#tagline a { background-image: expression(this.runtimeStyle.backgroundImage = "none", this.innerHTML = '<img src="http://www.llrx.com/themes/llrx/images/h2.gif" border="0" alt="' + this.innerHTML + '">'); }

您将节点的innerHTML分配给图片的ALT属性,但innerHTML包含未转义的HTML,因此您最终会创建一些非常时髦的HTML,如:

<img alt="<img alt="<img alt="<img alt="

截图可能会更好:

enter image description here