webbrowser-control

Passing a C# class instance back to managed code from JavaScript via COM

自古美人都是妖i 提交于 2019-12-22 04:54:12
问题 The basic outline of my problem is shown in the code below. I'm hosting a WebBrowser control in a form and providing an ObjectForScripting with two methods: GiveMeAGizmo and GiveMeAGizmoUser . Both methods return the respective class instances: [ComVisible] public class Gizmo { public string name { get; set; } } [ComVisible] public class GizmoUser { public void doSomethingWith(object oGizmo) { Gizmo g = (Gizmo) oGizmo; System.Diagnostics.Debug.WriteLine(g.name); } } In JavaScript, I create an

Correct way to set ScrollViewer (for vertical scrolling) on a WPF Frame?

亡梦爱人 提交于 2019-12-22 03:15:09
问题 does anyone know the difference between defining a vertical scrollbar on a frame like this: <ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto"> <Frame Name="Frame1" ScrollViewer.CanContentScroll="True" /> </ScrollViewer> or like this: <ScrollViewer Grid.Row="2"> <Frame Name="Frame1" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True" /> </ScrollViewer> This frame is nested in a WebBrowser control and setting it the first way correctly displays the

How to using XPath in WebBrowser Control?

这一生的挚爱 提交于 2019-12-22 01:27:45
问题 In C# WinForms sample application, I have used WebBrowser control. I want to use JavaScript XPath to select single node. To do this, I use XPathJS But with the following code, the returned value of vResult is always NULL. bool completed = false; WebBrowser wb = new WebBrowser(); wb.ScriptErrorsSuppressed = true; wb.DocumentCompleted += delegate { completed = true; }; wb.Navigate("http://stackoverflow.com/"); while (!completed) { Application.DoEvents(); Thread.Sleep(100); } if (wb.Document !=

Display Custom Dialog When File Downloaded

烈酒焚心 提交于 2019-12-21 21:42:21
问题 Looking for a solution to my issue. We are building a web browser control into a product for a client, they need to be able to detect when there is a File Upload box on a website, then instead of it launching the Windows 7 File Browser window, it needs to open their own custom designed one Is there a browser event that allows us to capture that? 回答1: You can hook up your own download manager that is effective only in your webbrowser control host process by implementing IServiceProvider in the

Web browser control open up the next page in IE on invoking form submit method

假装没事ソ 提交于 2019-12-21 21:39:44
问题 I am trying to create auto form submit application. I need to subscribe on different sites. It involves submitting two forms. I am using .Net web browser control. When i fill the first form and call submit method of the form or click method of the button, both opens up the next page in IE. ( In window browser the first form opens the next form in new tab on hitting submit button) HtmlElementCollection inputs = form.GetElementsByTagName("input"); foreach (HtmlElement input in inputs) { if

Embedding Firefox into a .NET control

♀尐吖头ヾ 提交于 2019-12-21 20:32:57
问题 I am beginner in c# and .net programing and I want to know whether i can use Mozilla Firefox as instance browser of webBrowser control, as by default webBrowser control use Internet Explorer. 回答1: The Mozilla ActiveX Control uses the Gecko layout engine to deliver a fully programmable HTML and XML rendering control for ActiveX developers. The API is similar to the Internet Explorer ActiveX control so it maintains a high degree of compatibility. Gecko is the same engine that powers Mozilla,

Implementing Drag and Drop Functionality WebBrowser Control Winforms C#

牧云@^-^@ 提交于 2019-12-21 19:39:46
问题 I need to capture drag and Drop Events of WebBrowser Control in WinForm C#. Is there any way ? 回答1: My Workarond: use a boolean member variable to detect if you call navigate from inside code or navigating is called from ouside code. Implement the "Navigating" (BeforeNavigating) event and check if it was a call from outside. Example: call navigate from inside: private void NavigateLocal(string htmlFileName) { this.localNavigate = true; this.webBrowser.Navigate(htmlFileName); } event method:

Removing HtmlElement objects programmatically using C#

こ雲淡風輕ζ 提交于 2019-12-21 12:44:07
问题 In a WebBrowser control, how do I remove HtmlElement objects? There are no methods in the HtmlElement class to accomplish this. As a workaround, I can create a "dummy" HtmlElement (without inserting it into the HtmlDocument ), into which I then insert (via AppendChild ) the HtmlElement objects to be removed. This feels like a hack. Is there a better way to do this? P.S. I want to retain the HtmlElement in memory to be used later, not simply destroy it (which is what setting its parent's

C# - How to control chrome browser

怎甘沉沦 提交于 2019-12-21 12:19:06
问题 I wanted to make an application wherein you specify the name of the websites, your username and password and that application automatically logs in to all your accounts in the specified websites. I have done this using windows form application, using a web browser. But i wanted my application to open all these websites in chrome and log it in there. Plz Help 回答1: I'd check out the chrome API failing that Look into getting a handle to the window through window API calls But why not just a

Use Blockly inside a WPF WebBrowser

青春壹個敷衍的年華 提交于 2019-12-21 08:48:42
问题 Is it possible to use the Blockly google javascript libraries inside a WPF WebBrowser? In particular, Blockly needs several js scripts. How can we reference the js libraries? 回答1: Short Answer You can use all blocky features including UI tools and API functions from WPF WebBrowser control. To do so you should: Create an HTML content which contains script tags referencing Blocky js , or methods which you want to call from C#, and required HTML and XML contents based on your requirement (for