webbrowser-control

Multiple WebBrower sessions / processes in one window

青春壹個敷衍的年華 提交于 2019-11-27 16:33:18
问题 I would like to create a .NET application that utilizes multiple instances of the WebBrowser control. The catch is that I'd like each web browser control to be running it's own session. IOW, I have a requirement that the collection of session cookies, javascript global namespace, etc. is separate for each instance and that all instances appear within the same window. AFAIK, this is going to require me to run each web browser control in a separate process. A few questions: Is my assumption

WP7 WebBrowser control zoom

喜欢而已 提交于 2019-11-27 16:27:31
问题 Some pages are too small and hard to read in WebBrowser control, is zooming possible? 回答1: If you have control of the html you can set the initial-scale of the viewport. More background here. The IE Mobile Viewport on Windows Phone 7 回答2: I went with the following hack: BrowserControl.LoadCompleted += Browser_dohack; private void Browser_dohack(object sender, NavigationEventArgs e) { string html = BrowserControl.SaveToString(); string hackstring = "<meta name=\"viewport\" content=\"width=320

How Can Read Web Page Using WebBrowser control

血红的双手。 提交于 2019-11-27 15:51:14
string urlt = webBrowser1.Url.ToString(); Webbrowser1.Navigate("Google.com") HtmlElement elem; if (webBrowser1.Document != null) { HtmlElementCollection elems = webBrowser1.Document.GetElementsByTagName("HTML"); if (elems.Count == 1) { elem = elems[0]; string pageSource = elem.InnerHtml; if (pageSource == "404" || pageSource == "Inter" || pageSource == "siteblocked") { } else { Ret2.Add("Page.." + "Url..." + urlt); } Am Using above mentioned code for reading WebPage at "DocumentCompleted" Event But If I am Using "For loop" for more then one Url It not calling to DocumentCompleted Event

How to getelement by class?

与世无争的帅哥 提交于 2019-11-27 15:43:53
I am trying to code a way using webBrowser1 to get a hold of of a download link via href, but the problem is I must find it using its class name. <body> <iframe scrolling="no" frameborder="0" allowtransparency="true" tabindex="0" name="twttrHubFrame" style="position: absolute; top: -9999em; width: 10px; height: 10px;" src="http://platform.twitter.com/widgets/hub.html"> ‌¶ <div id="main"> ‌¶‌→ <div id="header"> <div style="float:left;"> ‌¶‌→ <div id="content"> ‌¶‌→ <h1 style="background-image:url('http://static.mp3skull.com/img/bgmen.JPG'); background-repeat:repeat-x;">Rush‌·Mp3‌·Download</h1>

Can I wait for a webbrowser to finish navigating, using a for loop?

喜欢而已 提交于 2019-11-27 15:14:32
I have a for loop: for (i = 0; i <= 21; i++) { webB.Navigate(URL); } webB is a webBrowser control and i is an int. I want to wait for the browser to finish navigating. I found this , however: I don't want to use any APIs or addins I can't use another void function, as suggested in this answer Is there a way to wait while in a for loop? noseratio Assuming you host WebBrowser in a WinFroms application, you can do it in a loop easily and efficiently, using async/await pattern. Try this: async Task DoNavigationAsync() { TaskCompletionSource<bool> tcsNavigation = null; TaskCompletionSource<bool>

How to execute custom JavaScript in WebBrowser control? [duplicate]

ぐ巨炮叔叔 提交于 2019-11-27 15:09:25
问题 This question already has an answer here: How to inject Javascript in WebBrowser control? 15 answers I want to apply some styling commands to specific website inside WebBrowser control. The best way to do it is to invoke javascript (I want that style to be editable, with javascript it's easy). I know I can do it with webBrowser1.Navigate("javascript: alert('hi'); void(0);"); but maximum url length that webBrowser accepts is 502. How to execute longer scripts? Or maybe there is a way to append

How do I get a C# WebBrowser control to show jpeg files (raw)?

时间秒杀一切 提交于 2019-11-27 14:53:15
Does anyone know in .Net 2.0 - .Net 3.5 how to load a jpeg into a System.Windows.Forms.WebControl as a byte-array and with the right mimetypes set so it will show? Something like: webBrowser1.DocumentStream = new MemoryStream(File.ReadAllBytes("mypic.jpg")); webBrowser1.DocumentType = "application/jpeg"; The webBrowser1.DocumentType seems to be read only, so I do not know how to do this. In general I want to be able to load any kind of filesource with a mimetype defined into the browser to show it. Solutions with writing temp files are not good ones. Currently I have solved it with having a

Interaction between WebBrowser Control and Windows Forms

吃可爱长大的小学妹 提交于 2019-11-27 14:12:42
I am managing various contact information - phone, address, email, IM, other and I want it to look good and save real estate, so I want to display it in a WebBrowser control. I can create the markup and content dynamically into a stream and display it with any format with colors and font size easily adjusted. I can also put buttons <input> for Add, Edit, and Delete. I like this method, because it seems easier and better looking than a RichTextBox (correct me if you think otherwise.) The question is about responding to those buttons. If one is selected, I want to hide the WebBrowser and unhide

How to fix “The requested resource is in use. (Exception from HRESULT: 0x800700AA)”

本秂侑毒 提交于 2019-11-27 13:51:15
问题 How can I solve this error? "The requested resource is in use. (Exception from HRESULT: 0x800700AA)". This appears while navigating to a different website using the WebBrowser control in C# .NET. Why? 回答1: The WebBrowser control is considered "in use" if either a navigation action is currently being processed, or any blocking dialog from the control is currently open (including context menu, Javascript alerts, NTLM login dialog, etc.). You can use the WebBrowser.IsBusy property to detect

WebBrowser control and JavaScript errors

断了今生、忘了曾经 提交于 2019-11-27 13:35:52
When I access the page with the browser (ie9), the browser is rendering ok. When I use the WebBrowser control I have JavaScript errors. I know I can suppress the scripts errors, but I want them to run correctly, because they affect the rendering and the functionality of the page. How can I solve this problem ? Can I integrate IE9 directly in the Windows Form and use similar methods like with the WebBrowser control (navigate,get id, invoke click) ? Thanks. What I would do is assign an object to webbrowser.ObjectForScripting and then inject a javascript function that assigns windown.onerror to a