Juan
Juan

Reputation: 15715

WebBrowser stops responding on a particular webpage, but IE doesn't

If you make a WinForms app and add a WebBrowser control and navigate to this page:

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

The application will stop responding. IE, Chrome and Mozilla won't. Any idea of "what am I doing wrong"?

Upvotes: 3

Views: 236

Answers (2)

Chris Haas
Chris Haas

Reputation: 55437

The lines of CSS below are freaking it out:

/* 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 + '">'); }

You're assigning a node's innerHTML to an image's ALT attribute but the innerHTML contains unescaped HTML so you end creating some very funky HTML like:

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

A screenshot might show better:

enter image description here

Upvotes: 1

Ian Boyd
Ian Boyd

Reputation: 256771

He's right.

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

With the smallest form of the 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>

Be damned if i know why (yet).

Upvotes: 1

Related Questions