webbrowser-control

Disable Image loading on WebBrowser-Control C# .Net 2.0+

让人想犯罪 __ 提交于 2019-12-06 03:11:54
I am using vs2008 and I would like to disable image loading on my webbrowser control but I dont see any solution except for the WebBrowserEX which doesn't seem outside of .net 1.1. Anyone know how to do this? Thanks! you should replace its tag , give the following code a try var html = webBrowser.DocumentText; var newOne = Regex.Replace(html, "<img.*/>", "", RegexOptions.Multiline); webBrowser.DocumentText = newOne; 来源: https://stackoverflow.com/questions/1260615/disable-image-loading-on-webbrowser-control-c-sharp-net-2-0

Is there an event that fires when DOM is modified in MSHTML IE8?

落爺英雄遲暮 提交于 2019-12-06 02:13:30
问题 Trying to detect if new elements are added or removed from the DOM in MSHTML. Is there such event that will fire? http://msdn.microsoft.com/en-us/library/aa741877(v=VS.85).aspx In IE9 there is IDOMMutationEvent::initMutationEvent http://msdn.microsoft.com/en-us/library/ff975905(v=vs.85).aspx 回答1: Yes, it is possible now in IE8, though it is not part of the MSHTML event structure, but Accessibility. Trigger (EVENT_OBJECT_REORDER) is new in IE8 - See http://blogs.msdn.com/b/ie/archive/2008/12

Create a SSL WebRequest with C#

我们两清 提交于 2019-12-06 01:56:42
I'm making a code that reads the a page and downloads it contents programmatically, but it does not work same way as a browser. Note that I'm also using cookies string. my code is: string strUrl = "http:" + "//mgac.webex." + "com"; string cookies_str = "vSeg=post_attendee; s_nr=1321305381566-New; s_lv=1321305381566; s_vnum=1322686800567%26vn%3D1; galaxyb_wl=R2355168776; JSESSIONID=Qlq1TR7Hf09KTsGHr4vv2GnTFF0NGRlLmGyYmMvzY5M29pbZ8yNp!31020270; DetectionBrowserStatus=3|1|32|1|4|2; CK_LanguageID_503319=1; CK_TimeZone_503319=4; CK_RegionID_503319=2; vSeg=post_attendee; s_nr=1321305381566-New; s_lv

.Net How to get the ID of the clicked Element in a Webbrowser

霸气de小男生 提交于 2019-12-06 00:25:56
I want to get the HTML Id of the clicked Element in a Webbrowser. Example: If i click the Google Search button it should give me the HTML ID of the clicked element (in this case a button) How should i achieve that ? Edit: Webbrowser = The Web browser Control If it's for a Web browser control, then this article explains how to do it: https://www.codeproject.com/Articles/32279/How-To-Tell-What-is-Clicked-in-a-WebBrowser-Contro First off, we need to translate the mouse coordinates on the screen, into a Point object: Point ScreenCoord = new Point(MousePosition.X, MousePosition.Y); Now, we must

Ignoring web browser SSL security alerts in console application

强颜欢笑 提交于 2019-12-05 23:18:12
I'm creating a console application that is able to remotely capture screenshots of websites. Everything is working except the fact that I can't avoid Certificate errors. Every time I get popup message that I'm unable to pass. I tried using: ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(ValidateServerCertificate); But it doesn't work. Also tried the solution found here: http://www.codeproject.com/Articles/31163/Suppressing-Hosted-WebBrowser-Control-Dialogs but but it doesnt seem to work for webbrowser invoked from console application. Any

Why is the Webbrowser control DocumentComplete event fired for top level frame first?

一笑奈何 提交于 2019-12-05 21:47:47
Based on this article on MSDN: How To Determine When a Page Is Done Loading in WebBrowser Control , and from past discussions on StackOverflow, I would assume that in case of a document with multiple frames, the DocumentComplete event would fire multiple times, and the last time would be for the top level frame. However, using the exact sample code from the above-mentioned MSDN link, I find that if there are multiple DocumentComplete events when doing a Navigate to a URL, the condition is satisfied in the following code the first time, not the last time as the article seems to indicate.

Call JavaScript function from .NET Compact Framework in WebBrowser control

喜夏-厌秋 提交于 2019-12-05 17:47:01
Is there anyway to call a JavaScript function from .NET Compact Framework through the WebBrowser control? It works with the Navigate() Method. I just tried it with the Windows Mobile 5.0 Pocket PC Emulator. For example: webBrowser1.DocumentText = @"<html><head> <script type='text/javascript'> function doIt() { alert('hello again'); return 'i did it!'; } </script> </head><body>hello!</body></html>"; webBrowser1.Navigate(new Uri("javascript:doIt()")); 来源: https://stackoverflow.com/questions/3135586/call-javascript-function-from-net-compact-framework-in-webbrowser-control

Save WebBrowser Control Content to HTML

大城市里の小女人 提交于 2019-12-05 16:11:07
I have a WebBrowser Control and have called the Navigate(url) function of it for a given file. Then I have manipulated the DOM tree by giving new Id's to some of the tags. Now I want to save the result in an HTML file. I have tried to use the webBrowser.DocumentStream, but it seems that this stream won't change after manipulating the DOM tree. Please keep in mind that the encoding in WebBrowser.Document.Encoding must be used to encode the result. Like this: File.WriteAllText(path, browser.Document.Body.Parent.OuterHtml, Encoding.GetEncoding(browser.Document.Encoding)); 来源: https:/

DocumentComplete event in Embedded IWebBrowser2 using write() method

一笑奈何 提交于 2019-12-05 14:38:06
I've been looking hard for this but still have not found any solution. I'm using native win32 c++ (no MFC, ATL or .NET) I'm loading an html document with IHTMLDocument2->write(). I would like to get the event when the page is ready to show, meaning that all images and elements are downloaded and rendered. Following the embedded browser object from here embedded web control (IWebBrowser2), embedded javascript's onkeydown and onkeyup not firing and from here http://www.codeproject.com/Articles/3365/Embed-an-HTML-control-in-your-own-window-using-pla I managed to get an embedded web browser

Gecko API for DOM

微笑、不失礼 提交于 2019-12-05 13:37:36
Does Gecko expose an API for working directly with its DOM? I'm looking for a class like HtmlElement that can be used to build/traverse trees of HTML content. I'm trying to host Gecko as a web browser control in a desktop application, and would prefer a direct API rather than going through COM. Thanks! Yes, virtually all of the classes relating to the DOM are exposed through XPCOM . In fact, I believe the entire functionality of Gecko is exposed this way. greyfade: whilst your answer is technically correct, i've found that the gecko DOM API is incredibly hard to find, because of all the