webbrowser-control

How can I be notified when a window is closed by window.close (javascript)?

守給你的承諾、 提交于 2020-01-11 10:35:22
问题 I've been asked to retro-fit a custom web-browser built around the IE 9 control. One of the requirements was that all pop-up windows must be caught and redirected into a new tab. The customer didn't want any floating stand-alone windows to appear. The previous developer implemented the following function to capture these cases and open a new tab instead. public void NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl) {

How can I be notified when a window is closed by window.close (javascript)?

孤者浪人 提交于 2020-01-11 10:35:08
问题 I've been asked to retro-fit a custom web-browser built around the IE 9 control. One of the requirements was that all pop-up windows must be caught and redirected into a new tab. The customer didn't want any floating stand-alone windows to appear. The previous developer implemented the following function to capture these cases and open a new tab instead. public void NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags, string bstrUrlContext, string bstrUrl) {

NavigateToStream. What URI (if any) is used for resolving relative links?

好久不见. 提交于 2020-01-11 10:11:48
问题 I have an WPF application which uses a <WebBrowser> object to display some content which is in turn wrapped in HTML -- I want to generate that HTML on the fly, but it will hold links to different kinds of static content which will be local files. In a normal web application, I would try to use relative URIs for this -- they will be looked up relative to the URI of the dynamic page. The problem is if I use WebBrowser.NavigateToStream (or .NavigateToString ). In this case what is the "root" URI

DEL and BACKSPACE keys get eaten from WebBrowser

你离开我真会死。 提交于 2020-01-11 09:08:48
问题 I have a custom task pane in a VSTO Outlook add-in which hosts a System.Windows.Forms.WebBrowser control. All works well but in web forms DEL and BACKSPACE keys do not work. As if something eats those keys before they get to the browser. Any pointers are appreciated. EDIT: It seems that clicking the WebBrowser does not activate the parent task pane. If I add a simple TextBox as a sibling to WebBrowser and then click TextBox with a mouse, task pane's title bar color changes indicating it got

C# WPF - Waiting for page to load

风格不统一 提交于 2020-01-11 06:41:30
问题 I have seen several threads on StackOverflow concerning this topic, however none of them seem to provide an answer. I have a button that, when clicked, opens up an invisible web page, navigates to a URL, enters information into a box, presses a button, and then scrapes the screen for information. The bones of my code basically in the click: WebBrowser wb = new WebBrowser; wb.Visibility = System.Windows.Visibility.Hidden; wb.Navigate("http://somepage.com"); And this is where it gets tricky. I

Setting Value of an Input Tag in WebBrowser Control

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-11 04:48:05
问题 I am attempting to help a user log into their account using a custom WebBrowser control. I am trying to set the value of an input tag to the players username using the WebBrowser 's InvokeScript function. However, my current solution is doing nothing but rendering a blank white page. My current code looks like this (web is the name for my WebBrowser control): web.Navigate(CurrentURL, null, @"<script type='text/javascript'> function SetPlayerData(input) { username.value = input; return true; }

WebBrowser control throws seemingly random NullReferenceException

孤者浪人 提交于 2020-01-09 10:36:30
问题 For a couple of days I am working on a WebBrowser based webscraper. After a couple of prototypes working with Threads and DocumentCompleted events, I decided to try and see if I could make a simple, easy to understand Webscraper. The goal is to create a Webscraper that doesn't involve actual Thread objects. I want it to work in sequential steps (i.e. go to url, perform action, go to other url etc. etc.). This is what I got so far: public static class Webscraper { private static WebBrowser _wb

WebBrowser control throws seemingly random NullReferenceException

ぐ巨炮叔叔 提交于 2020-01-09 10:34:15
问题 For a couple of days I am working on a WebBrowser based webscraper. After a couple of prototypes working with Threads and DocumentCompleted events, I decided to try and see if I could make a simple, easy to understand Webscraper. The goal is to create a Webscraper that doesn't involve actual Thread objects. I want it to work in sequential steps (i.e. go to url, perform action, go to other url etc. etc.). This is what I got so far: public static class Webscraper { private static WebBrowser _wb

IE10 - how to prevent “Your current security settings do not allow this file to be downloaded” popup from appearing?

送分小仙女□ 提交于 2020-01-09 10:27:26
问题 I’m using wpf WebBrowser control (System.Windows.Controls) and I need to prevent users from performing various actions like downloading files or printing pages. I have disabled file download option in Internet Explorer options (Security tab -> Custom Level -> Downloads -> File Download). Because of that, after clicking let’s say on a pdf link, instead of a file download popup I get a popup with such a message: "Your current security settings do not allow this file to be downloaded". Is there

Open new web page in new tab in WebBrowser control

旧时模样 提交于 2020-01-09 08:15:06
问题 I'm using WebBrowser control in my c# application, and I want to open web pages in it. It's completely done. My problem: Any link in the web page that its target is _blank will open in new IE Window. I'd like to open such link in new tab in my application. How to do it? Thanks! 回答1: private void Browser_ProgressChanged(object sender, WebBrowserProgressChangedEventArgs e) { var webBrowser = (WebBrowser)sender; if (webBrowser.Document != null) { foreach (HtmlElement tag in webBrowser.Document