webbrowser-control

How to programmatically turn off quirks mode in IE8 WebBrowser control?

那年仲夏 提交于 2019-11-27 13:35:28
I want to use IE8 as a WebBrowser control in a C# application. How can I disable "quirks mode" and force IE into standards compliance (as far as it is implemented)? I think the issue you're facing is described in IEBlog: WebBrowser Control Rendering Modes in IE8 : While webmasters can easily alter their site to render properly in the new version of IE, many software vendors do not have the resources to instantly push out new versions of their applications with updated internal pages. In order to ensure that these existing applications remain in working order, IE8 renders pages running within

Retrieving Selected Text from Webbrowser control in .net(C#)

泪湿孤枕 提交于 2019-11-27 13:16:10
I've been trying to figure out how to retrieve the text selected by the user in my webbrowser control and have had no luck after digging through msdn and other resources, So I was wondering if there is a way to actually do this. Maybe I simply missed something. I appreciate any help or resources regarding this. Thanks You need to use the Document.DomDocument property of the WebBrowser control and cast this to the IHtmlDocument2 interface provided in the Microsoft.mshtml interop assembly. This gives you access to the full DOM as is available to Javascript actually running in IE. To do this you

How to handle javascript events via WebBrowser control for WinForms

别等时光非礼了梦想. 提交于 2019-11-27 12:50:27
I have read WebBrowser Control from .Net — How to Inject Javascript , Is it possible to call Javascript method from c# winforms and many others. Those examples were returns function value or alert window (synchronous calls). I have to get result from event handler (asyn call): <script type="text/javascript"> window.onload = function() { var o = new M.Build(document.getElementById("ZID")); M.Events.observe(o, o.Events.Success, function() { // I have to get some value!! }); M.Events.observe(o, o.Events.Fault, function() { // I have to get some value!! }); } </script> Calling C# from JavaScript

How to deactivate “right click” on WPF Webbrowser Control?

守給你的承諾、 提交于 2019-11-27 12:48:44
I can't seem to find an answer to this. Does anyone know? Thanks Simon Mourier Here is the code of a utility class that allows you to deactivate WPF's WebBrowser context menu. It also allows you to suppress script errors ( WPF WebBrowser control - how to supress script errors? ) and change IE's DOCHOSTUIFLAG . Usage sample: public partial class Player : Window { private WebBrowserHostUIHandler _wbHandler; public Player() { InitializeComponent(); ... _wbHandler = new WebBrowserHostUIHandler(MyWebBrower); _wbHandler.IsWebBrowserContextMenuEnabled = false; } } Utility code: public class

Displaying html from string in WPF WebBrowser control

烂漫一生 提交于 2019-11-27 11:17:46
My data context object contains a string property that returns html that I need to display in WebBrowser control; I can't find any properties of WebBrowser to bind it to. Any ideas? Thanks! Abe Heidebrecht The WebBrowser has a NavigateToString method that you can use to navigate to HTML content. If you want to be able to bind to it, you can create an attached property that can just call the method when the value changes: public static class BrowserBehavior { public static readonly DependencyProperty HtmlProperty = DependencyProperty.RegisterAttached( "Html", typeof(string), typeof

How to get an HtmlElement value inside Frames/IFrames?

旧时模样 提交于 2019-11-27 09:46:43
I'm using the Winforms WebBrowser control to collect the links of video clips from the site linked below. LINK But, when I scroll element by element, I cannot find the <video> tag. void webBrowser_DocumentCompleted_2(object sender, WebBrowserDocumentCompletedEventArgs e) { try { HtmlElementCollection pTags = browser.Document.GetElementsByTagName("video"); int i = 1; foreach (HtmlElement link in links) { if (link.Children[0].GetAttribute("className") == "vjs-poster") { try { i++; } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } // Added by edit } Soon after using the

Set WPF webbrowser control to use IE10 mode

主宰稳场 提交于 2019-11-27 09:04:34
How can i set the WPF webbrowser controls to render pages in iE10 mode or the higher version installed on machine . By default if i create a .net 4 or .net 4.5 application on any machine of OS > windows 7 , it renders the html pages in IE7 mode only. (Please correct if i am wrong) How to enable the application to render the html pages in IE10 mode if IE10 installed on target machine ? Any helps You can use the registry as described here: http://msdn.microsoft.com/en-us/library/ie/ee330730%28v=vs.85%29.aspx EDIT: for a better explanation you can read this answer too Will the IE9 WebBrowser

Prevent from displaying of Windows Security window

☆樱花仙子☆ 提交于 2019-11-27 08:59:31
I have some router config page URLs, I have to load them, set sth and save it. I'm using webbrowser control and .Net 4.5 and C# language. But every time a page loads, windows security pops up and asks for username and password. It happens for each URL. How can I prevent from this? Usernames and passwords are same for all of the URLs. How can I use hardcode to set username and password for all of them?! You need to provide an implementation of IAuthenticate COM interface to the WebBrowser object via IServiceProvider . Your implementation of IAuthenticate::Authenticate will be called when

serialize browsing number of URLs using webbrowser control

我怕爱的太早我们不能终老 提交于 2019-11-27 08:50:51
问题 I'm using webbrowser control... This is my code : private void button1_Click(object sender, EventArgs e) { foreach (string s in URLsList) { webBrowser1.Navigate(s); } private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { //Do something } but how can I serialize browsing of URLs and execute DocumentCompleted for each of them? How can I prevent from conflicts? 来源: https://stackoverflow.com/questions/19279526/serialize-browsing-number-of-urls-using

Web browser control emulation issue (FEATURE_BROWSER_EMULATION)

╄→尐↘猪︶ㄣ 提交于 2019-11-27 08:47:55
Using VS2013 I created a very simple web browser Control application that navigates to http://demos.dojotoolkit.org/demos/calendar/demo.html When no FEATURE_BROWSER_EMULATION is set for this application in the registry the site functions correctly, When adding the application to this registry key (under HKLM) it is working till IE9 emulation but fails with IE10 and IE11 values (i have IE11 on my machine). example: FEATURE_BROWSER_EMULATION myApp=9999 - works myApp=10001 - doesn't work doesn't work = month date picker is not working Any suggestion what can be the problem? Thanks, Guy Below is