webbrowser-control

How to get font size of currently selected text in WebBrowser control

Is there any way to get the font size of the currently selected text in the Microsoft WebBrowser control (MSHTML)? I am aware of IHTMLDocument2::queryCommandState("FontSize", ...), but this method only returns a value between 1 and 7, for the outdated font sizes "xx-small" to "xx-large". For font sizes like "10pt" or "14px", no useful v...

why can't I navigate to a page in the webbrowser control during runtime?

When I do something like this webBrowser1 = new WebBrowser(); webBrowser1.Url = new Uri("http://google.com"); webBrowser1.Navigate("http://google.com"); all I get is a blank window. when I step through this webBrowser1.Url stays = null after the second statement has executed. Why is that? if I set the url property before I co...

WebBrowser control has different results for loading URL and setting DocumentText containing Silverlight

I have a .NET 2.0 app (using C#) that shows some dynamically constructed HTML pages, some of which contain Silverlight. Here's a simple example of the HTML (Note, I am using absolute paths): <html> <head></head> <body> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" he...

Capturing cookie responses in C#

Using Web Browser control or http request in C#, when a website creates a cookie (or tries to), is there a way to capture and display that cookie? ...

Reflection and attributes -- removal? modification? OR windows service in full trust?

I want to remove the security permissions from a class I don't have access to the source for. Is it possible to, via reflection, remove or modify the attribute? [...PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust"), PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] after some consideration, it's occurred to...

Can I remove an already rendered CSS attribute or declaration?

Is there any way to remove a CSS attribute/declaration that has already been rendered on an element? For example, if I'm using a CSS reset stylesheet to set the margin on images to 0, I can no longer use hspace or vspace values (yes, I know they're deprecated in HTML 4+). Is there a way to remove this declaration so the browser renders...

Better option for hosting MS Office documents in custom app?

I am currently hosting an IE Browser control in a .NET (2.0) Form and using it to load Office files such as Excel and Word thusly: _ieCtrl.Navigate("C:\\test.xls", False); The hosting and loading works well except whenever I navigate to a file I am presented with a dialog that asks whether I want to save or open the file. (This is sta...

How can I progmatically click a link in a Winform Web Browser control?

I would like to know how to programatically click a link from with in a Winform Web Browser control. foreach (HtmlElement linkElement in webBrowser.Document.GetElementsByTagName("A")) { if(linkElement.InnerText == "Helpful Tips") { //Click Functionality } ...

Want to enable BHO in a WebBrowser Control embedded in a standard C# App

I have a standard winforms C# app with a webbrowser control dragged onto it. We also have a C++ BHO that we generally interact with through COM when it runs inside IE7 or IE8. I don't see any way to tell the webbrowser control to load the BHO. The BHO doesn't show any GUI or anything, it just listens to the http traffic when used fro...

How to disable caching in the .NET WebBrowser Control?

I have been googling for hours and trying to figure this out, and I just can't. I have 1 webbrowser control on a form, webbrowser1. Once I load a page, say google.com, if I use webbrowser1.refresh() or webbrowser1.navigate("google.com"), it's not reloading the page, it has it cached so it's just reloading the cache. This is terribly appa...

How to simulate a "open link on new window" on a C# WebBrowser?

I just found out that to simulate a click I can call element.InvokeMember("click"); where element is an HtmlElement. But what I actually need is to open the link in a new window, but not on the default browser but on another WebBrowser I would create in my program. Sometimes it works to just get the href attribute by calling element.GetA...

Webbrowser control document_completed fires more than once

Hi, The event of document_complete fires more than once. Which isn't really that bad. But the url i'm navigating to, never gets completely loaded. It gets fired like 2/3 times. This is my document_completed event: private void webBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { if (e.Url.AbsoluteP...

vb6 Capture Entire Web Page

Hey all, I've been trying to find the code that allowed me to capture an entire web page using the webbrowser1 control and i believe also a picturebox or 2.. but i am not able to find the code that i used a couple months ago! I've been goodgling until I'm all googled out! If anyone knows of the code for VB6 then please post a link to it...

How to select a class by GetElementByClass and click on it programmically.

I have been trying to use this code to read the element by class in html/ajax knowing GetElementByClass is not a option in webBrowser.Document. I can't seem to get a return value then invoke the member. Is there a work around for this? References: Getting HTMLElements by Class Name Example: <span class="example">(<a href="http://www.t...

WebBrowser, IPersistStreamInit and javascript

For one of our desktop applications we use a HTML-based interface, loaded from local files into a WebBrowser control. This works fine, but now we want to load the files from a different source, and are trying to stream them in using IPersistStreamInit (like this example on MSDN). It seems to work OK, except for the referenced javascrip...

Memory Could Not Be Written error Using System.Windows.Forms.WebBrowser

Using a C# Windows Forms application and after browsing to several URLs and then closing the application, the application waits for about 20 seconds and then throws this error: The instruction at "0x30cb0de8" referenced memory at "0x00000000". The memory could not be "written". Click OK to terminate the program. I tried calling Di...

Why do HTTPWebRequests and the WebBrowser control seem to perform more slowly for me when run from an EXE invoked by a windows service?

So I'm running a Windows Service as a user. Admin rights. This service launches an EXE via Process.Start. Within the EXE, a WebBrowser control is used to navigate to a website, log in, handle all the security handshaking, and get some data. It comes back out, writes the data to a file. Not the most efficient process, admittedly, but...

How can I invoke this onkeydown event with a WebBrowserControl in C#?

<input onkeydown="if(isNumber(event)) { this.value = isNumber(event); ajax_submit(this.form); bump_recruiter(); el('altsubmit').setAttribute('disabled', 'disabled'); return false; }" class="captcha" type="text" id="number" name="number" value=""> That is the html. I tried this within the webBrowser.Navigate method: javascript: ajax_su...

CHtmlView class and focus

I am having Dialog Box Application written in MFC. Dialog is having 3 child controls on it. 2 Buttons (Button 1 & Button 2) and a HTML Control (Class derived from CHtmlView) HTML Control has been navigated to a HTML page having 2 checkboxes (Check Box 1 & Check Box 2). Control Z-Order for focus should be like: Button 1 Button 2 HTML Con...

Forms.WebBrowser strange behavour

I have a Webbrowser control that I am using to generate thumbnails of web pages. Below is my code: webBrowser.AllowNavigation = true; webBrowser.Navigate(@"about:blank"); webBrowser.DocumentText = url; if (webBrowser.Document != null) webBrowser.Document.Write(url); Where url is a string containing the html. Using the above code r...