I am looking for a way to get the string of JavaScript alerts messages instead of showing it as message box,now, I am using a code to block alerts form a web page, this is the code (c#):
HtmlElement head = webBrowser1.Document.GetElementsByTagName("head")[0];
HtmlElement scriptEl = webBrowser1.Document.CreateElement("script");
IHTMLScriptElement element = (IHTMLScriptElement)scriptEl.DomElement;
string alertBlocker = "window.alert = function () { }";
element.text = alertBlocker;
head.AppendChild(scriptEl);
I have this in web browser control navigated event.
I am very new to JavaScript that's why :)
Thank you very much.