webbrowser-control

How to wait until WebBrowser is completely loaded in VB.NET?

我怕爱的太早我们不能终老 提交于 2019-11-26 15:28:46
I am using the WebBrowser control in my VB.NET application to load a few URLs ( ~10-15) and save their HTML source in a text file. However, my code doesn't write the source of the current page rather the initial one because the it is triggered even before the page is loaded. How can I wait until the page is completely loaded before calling any event? I tried the following code but it doesn't work. Do Until WebBrowser1.ReadyState = WebBrowserReadyState.Complete Application.DoEvents() Loop Sounds like you want to catch the DocumentCompleted event of your webbrowser control. MSDN has a couple of

How do I turn off Compatibility View on the IE WebBrowserControl in a WinForms app?

社会主义新天地 提交于 2019-11-26 15:16:36
In my WinForms app, if I use a WebBrowser control, it seems to be forced into compatibility mode. How can I disable this, and make it behave the same as standalone IE does on my machine when browsing the same site? I do not want to make registry changes. I want everything to be contained within my app. The website I'm loading is not mine, so I do not have the ability to make changes to it (unless they can be done programmatically from within my app). There is no way to do this other than configuring the following registry settings: HKLM\Software\Microsoft\Internet Explorer\Main\FeatureControl

Disable Drag and Drop on HTML elements?

喜欢而已 提交于 2019-11-26 15:07:08
I'm working on a web application for which I'm attempting to implement a full featured windowing system. Right now it's going very well, I'm only running into one minor issue. Sometimes when I go to drag a part of my application (most often the corner div of my window, which is supposed to trigger a resize operation) the web browser gets clever and thinks I mean to drag and drop something. End result, my action gets put on hold while the browser does its drag and drop thing. Is there an easy way to disable the browser's drag and drop? I'd ideally like to be able to turn it off while the user

Webpage works in IE, Chrome and Firefox, but not when using the .NET WebBrowser control

杀马特。学长 韩版系。学妹 提交于 2019-11-26 14:44:09
I'm using the WebBrowser control in Visual Studio 2010 and trying to display the page: http://lk21.org . Inside that webpage there are lots of scripts loaded, and it works fine if I open it through a web browser such as Firefox, Chrome, and the latest version of IE. My question is, why does it display "Bad Request" when I tried using the WebBrowser component to navigate to that page? Check this out: UPDATE: The page loads nicely using Visual Vincent's answer. However the flash videos on the website (or I think it's something similar to flash) is unable to be played. See the comparison in the

Download a file through the WebBrowser control

大憨熊 提交于 2019-11-26 14:17:27
问题 I have a WebBrowser control on a form, but for the most part it remains hidden from the user. It is there to handle a series of login and other tasks. I have to use this control because there is a ton of Javascript that handles the login. (i.e., I can't just switch to a WebClient object.) After hopping around a bit, we end up wanting to download a PDF file. But instead of downloading, the file is displayed within the webBrowser control, which the user can not see. How can I download the PDF

Load local HTML file in a C# WebBrowser

余生长醉 提交于 2019-11-26 13:02:02
In my app I have a WebBrowser element. I would like to load a local file in it. I have some questions: Where to place the HTML file (so that it will also be installed if a user executes the setup) how to reference the file? (e.g. my guess is the user's installation folder would not always be the same) EDIT I've added the HTML file to my project. And I have set it up so that it gets copied to output folder. When I check it it is present when run: \bin\Debug\Documentation\index.html However when I do the following I get a 'Page cannot be displayed' error in the webbrowser element. I use the

Detect WebBrowser complete page loading

喜夏-厌秋 提交于 2019-11-26 13:01:59
How can I detect when a System.Windows.Forms.WebBrowser control has completed loading? I tried to use the Navigate and DocumentCompleted events but both of them were raised a few times during document loading! Paul Kearney - pk I think the DocumentCompleted event will get fired for all child documents that are loaded as well (like JS and CSS, for example). You could look at the WebBrowserDocumentCompletedEventArgs in DocumentCompleted and check the Url property and compare that to the Url of the main page. Kyle Rozendo I did the following: void BrowserDocumentCompleted(object sender,

Disable JavaScript error in WebBrowser control

徘徊边缘 提交于 2019-11-26 12:58:28
I am developing a windows application with a WebBrowser control that navigates to a sharepoint site. My problem is that i am getting JavaScript error. How can i disable the JavaScript error? I don't want them to pop up. Matt Jacobsen webBrowser.ScriptErrorsSuppressed = true; This disables the script errors and also disables other windows.. such as the NTLM login window or the client certificate accept window. The below will suppress only javascript errors. // Hides script errors without hiding other dialog boxes. private void SuppressScriptErrorsOnly(WebBrowser browser) { // Ensure that

Setting a cookie in a WebBrowser control

半腔热情 提交于 2019-11-26 12:44:19
问题 I am loading a website using a WebBrowser\'s Navigate function, and I want the browser to load the page with a cookie I\'ve given it. The following code doesn\'t work: wb.Navigate(url, null, null, \"Cookie: \" + cookie + \"\\n\"); What am I doing wrong? Will I have to use InternetSetCookie? This doesn\'t seem like the best solution. 回答1: Looks like there is a better way: Import the InternetSetCookie function: [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)] static

Options for embedding Chromium instead of IE WebBrowser control with WPF/C#

守給你的承諾、 提交于 2019-11-26 12:39:35
Internet Explorer-based WPF WebBrowser control suffers from some keyboard and focus issues and memory leak issues . As an alternative solution to these problems, we're considering available options for hosting Chromium instead of WebBrowser control in our WPF/C# project based around HTML editing. Similar questions have been asked here previously. I've read the answers and done my own research, but I hope to obtain some more feedback from people who have actually used any of the following options in production-quality projects : Awesomium and Awesomium.NET It looks very appropriate, but I don't