Hi mshauny,
OK now I got it. Even though I must admit it's a terrible hack.
But it works:
<html>
<head>
</head>
<body onload="javascript:doIt();">
<div>Here's a little something</div>
<div id="test">Nothing to see here!</div>
<div>Something ...</div>
</body>
<script type="text/javascript">
function doIt()
{
alert("Wazzup!?");
var ele = document.getElementById("test");
if(ele)
{
alert("Right on bro!");
ele.innerHTML = "<a href='http:
window.status="done setting up links";
}
else
{
alert("Epic fail, looser!");
}
}
</script>
</html>
void webBrowser1_StatusTextChanged(object sender, System.EventArgs e)
{
if (webBrowser1.StatusText.Contains("done setting up links"))
{
HtmlElementCollection coll = webBrowser1.Document.GetElementsByTagName("a");
webBrowser1.Document.Window.StatusBarText = "And now for something completely different";
}
}
First code block is the html from the former version of my answer. After the links are created dynamically the windows status text is modified. This is detected by the second code block which lives inside the windows forms code file. I couldn't find this event in the Properties/Events dialog ina Visual Studio but I found that such an event exists for webBrowser thanks to MSDN and intellisense. The setting of status text inside event handler to something other than "done setting up links" is nescessary because status text is overwritten for some occurring actions on the page and later restored.
This would cause the if expression to be true more than once, but we only need
it once after the javascript setup of the links.
All thats left to do now is to hook up the event handler with the event in the followin code block that lives inside From.Design.cs: InitializeComponent():
this.webBrowser1.StatusTextChanged += new System.EventHandler(webBrowser1_StatusTextChanged);
Please tell me what you think about this "special" solution.
Cheers
Manfred