webbrowser-control

Handling hardware back button and sending it to WebBrowser control running on Windows Phone

别等时光非礼了梦想. 提交于 2019-11-29 04:35:16
I have a web browser control embedded into a PhoneApplicationPage. I have to handle the hardware back button and force the web browser to go back. I know how to handle hardware back button. How do you force the webbrowser to go to a previous page? The seemingly simple GoBack() and CanGoBack property on WinForms webbrowser seems to be missing on Windows Phone. If you enable script on the WebBrowser control by setting IsScriptEnabled="true" you can then use the following to navigate backwards within the browser: private void backButton_Click(object sender, EventArgs e) { try { browser

How to open a link in webBrowser control in external browser?

和自甴很熟 提交于 2019-11-29 03:14:40
I have a textBox and a webBrowser control in my Windows Forms application. Whenever a user enters a HTML code in textBox, the webBrowser control shows its compiled form. The code for this: private void textBox2_TextChanged(object sender, EventArgs e) { webBrowser1.DocumentText = textBox2.Text; } But whenever I click a link in the webBrowser control, it opens it in the same webBrowser control. What I want is that it should open in default web browser of the system. So is there any event for this webBrowser control that handles link clicking? The easiest way to do this would be to intercept the

Using XPath and WebBrowser Control to select multiple nodes

三世轮回 提交于 2019-11-29 02:46:05
In C# WinForms sample application I have used WebBrowser control and JavaScript-XPath to select single node and change that node .innerHtml by the following code: private void MainForm_Load(object sender, EventArgs e) { webBrowser1.DocumentText = @" <html> <head> <script src=""http://svn.coderepos.org/share/lang/javascript/javascript-xpath/trunk/release/javascript-xpath-latest-cmp.js""></script> </head> <body> <img alt=""0764547763 Product Details"" src=""http://ecx.images-amazon.com/images/I/51AK1MRIi7L._AA160_.jpg""> <hr/> <h2>Product Details</h2> <ul> <li><b>Paperback:</b> 648 pages</li>

WatiN and .net winforms WebBrowser control - is DialogWatcher possible?

筅森魡賤 提交于 2019-11-29 02:39:31
Our target is: Watin-enabled browser testing embedded in a .net winform. Currently, we are using a .net WebBrowser control to embed browser behavior in a winform. We are attaching WatiN to the WebBroswer control on the form with code like this ( thanks prostynick ): var thread = new Thread(() => { Settings.AutoStartDialogWatcher = false; var ie = new IE(webBrowser1.ActiveXInstance); ie.GoTo("http://www.google.com"); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); The problem is this - the "winform browser" needs to handle popups during testing/automation. Question: How can

How to update DOM content inside WebBrowser Control in C#?

一个人想着一个人 提交于 2019-11-29 02:32:15
I've a windows .Net Form which contains a WebBrowser Control. This WebBrowser displays a webpage based on its Url property. Can I modify the DOM of the displayed page inside the WebBrowser control ? If yes, how to ? For those who are interested, here's the solution: HtmlElement headElement = webBrowser1.Document.GetElementsByTagName("head")[0]; HtmlElement scriptElement = webBrowser1.Document.CreateElement("script"); IHTMLScriptElement domScriptElement = (IHTMLScriptElement)scriptElement.DomElement; domScriptElement.text = "function applyChanges(){/*DO WHATEVER YOU WANT HERE*/}"; headElement

How to execute custom JavaScript in WebBrowser control? [duplicate]

时光总嘲笑我的痴心妄想 提交于 2019-11-28 23:57:30
This question already has an answer here: How to inject Javascript in WebBrowser control? 15 answers I want to apply some styling commands to specific website inside WebBrowser control. The best way to do it is to invoke javascript (I want that style to be editable, with javascript it's easy). I know I can do it with webBrowser1.Navigate("javascript: alert('hi'); void(0);"); but maximum url length that webBrowser accepts is 502. How to execute longer scripts? Or maybe there is a way to append my CSS to web document? P.S. I can't edit document's text property since it'll break scripts in this

How to fix “The requested resource is in use. (Exception from HRESULT: 0x800700AA)”

好久不见. 提交于 2019-11-28 21:26:56
How can I solve this error? "The requested resource is in use. (Exception from HRESULT: 0x800700AA)". This appears while navigating to a different website using the WebBrowser control in C# .NET. Why? Sheng Jiang 蒋晟 The WebBrowser control is considered "in use" if either a navigation action is currently being processed, or any blocking dialog from the control is currently open (including context menu, Javascript alerts, NTLM login dialog, etc.). You can use the WebBrowser.IsBusy property to detect these states. If due to a currently incomplete navigation action, you could try to stop the

How can I hide the Adobe Reader toolbar when displaying a PDF in the .NET WebBrowser control?

淺唱寂寞╮ 提交于 2019-11-28 20:27:09
I am trying to load a PDF document inside a .NET web browser control. In versions of Adobe Reader prior to v10 (aka "X"), the PDF loaded without the toolbar displayed—you would just see the PDF document. In the newly-released Reader v10, there is a toolbar that I do not wish to see. I am wondering if anyone knows how to hide this toolbar. I'm thinking that the answer may lie in the Registry, as there is no direct code that I am using to access Reader. Everything is handled by mime types through the WebBrowser control. My code to load the PDF file is as follows: string url = @"http://www.domain

How to clear System.Windows.Forms.WebBrowser session data?

混江龙づ霸主 提交于 2019-11-28 16:01:07
问题 How can I clear current session data (cookies, cached data, auth sessions, etc) without restarting the application? Update: I'm talking about WebBrowser control in Windows.Forms, not the ASP.Net session. 回答1: To clear session (such as HttpOnly cookies), you can use InternetSetOption() from wininet.dll. private const int INTERNET_OPTION_END_BROWSER_SESSION = 42; [DllImport("wininet.dll", SetLastError = true)] private static extern bool InternetSetOption(IntPtr hInternet, int dwOption, IntPtr

serialize browsing number of URLs using webbrowser control

一曲冷凌霜 提交于 2019-11-28 14:42:06
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-webbrowser-control