I have a simple webpage with only 3 links displayed in my webbrowser component:
<a href="/newpage1.html" id="el-1">Go to new page 1</a>
<a href="/newpage2.html" id="el-2">Go to new page 2</a>
<a href="/file.zip" id="el-1">Download file</a>
I register an event handler for the click event on a list of elements
foreach (HtmlElement e in this.webBrowserMain.Document.GetElementsByTagName("a")){
e.Click += this.SingleElementClickHandler;
}
Let’s assume that server side the following headers are sent for the file /file.zip
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename="file.zip"');
How can I write the SingleElementClickHandler to pop up a message box with the text “Hello” when a file is downloaded and not when another web page is opened?
I can’t use any third party component.
Simply
Found this after a bit more of search here and in this SO question (even if it is wpf component and not winforms component).