webbrowser-control

Why is the Webbrowser control DocumentComplete event fired for top level frame first?

一笑奈何 提交于 2019-12-07 13:32:06
问题 Based on this article on MSDN: How To Determine When a Page Is Done Loading in WebBrowser Control, and from past discussions on StackOverflow, I would assume that in case of a document with multiple frames, the DocumentComplete event would fire multiple times, and the last time would be for the top level frame. However, using the exact sample code from the above-mentioned MSDN link, I find that if there are multiple DocumentComplete events when doing a Navigate to a URL, the condition is

Call JavaScript function from .NET Compact Framework in WebBrowser control

╄→гoц情女王★ 提交于 2019-12-07 11:08:54
问题 Is there anyway to call a JavaScript function from .NET Compact Framework through the WebBrowser control? 回答1: It works with the Navigate() Method. I just tried it with the Windows Mobile 5.0 Pocket PC Emulator. For example: webBrowser1.DocumentText = @"<html><head> <script type='text/javascript'> function doIt() { alert('hello again'); return 'i did it!'; } </script> </head><body>hello!</body></html>"; webBrowser1.Navigate(new Uri("javascript:doIt()")); 来源: https://stackoverflow.com

How to set current document.domain in WebBrowser Control to avoid “Access is denied”?

余生颓废 提交于 2019-12-07 10:33:18
问题 How can I set current document.domain in WebBrowser Control to avoid "Access is denied" in Cross-domain calls (XMLHTTP Requests or Iframe/frame access)? I've tried CurrentDocument = WebBrowserControl.Document CurrentDocument.domain = "example.com" Console.writeline("xx" & CurrentDocument.domain) This doesn't work, somehow it never reaches console.writeline Am I doing something wrong? Or should I use WebBrowserControl.ActiveXInstance ? 回答1: What language are you writing this in? Are you

Save WebBrowser Control Content to HTML

烂漫一生 提交于 2019-12-07 09:18:23
问题 I have a WebBrowser Control and have called the Navigate(url) function of it for a given file. Then I have manipulated the DOM tree by giving new Id's to some of the tags. Now I want to save the result in an HTML file. I have tried to use the webBrowser.DocumentStream, but it seems that this stream won't change after manipulating the DOM tree. Please keep in mind that the encoding in WebBrowser.Document.Encoding must be used to encode the result. 回答1: Like this: File.WriteAllText(path,

Better option for hosting MS Office documents in custom app?

柔情痞子 提交于 2019-12-07 08:14:17
问题 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 standard IE file-download behavior.) I always want to open it of course and I do not want the dialog to show. Another issue is that when I close the window that

Gecko API for DOM

房东的猫 提交于 2019-12-07 07:25:39
问题 Does Gecko expose an API for working directly with its DOM? I'm looking for a class like HtmlElement that can be used to build/traverse trees of HTML content. I'm trying to host Gecko as a web browser control in a desktop application, and would prefer a direct API rather than going through COM. Thanks! 回答1: Yes, virtually all of the classes relating to the DOM are exposed through XPCOM. In fact, I believe the entire functionality of Gecko is exposed this way. 回答2: greyfade: whilst your answer

Disable Cookie read/write in webbrowser c# application

回眸只為那壹抹淺笑 提交于 2019-12-07 07:04:59
问题 I want websites to not able to read cookies or write new cookies in a webbrowser c# control application. I will prefer to disable all read/write cookies operation for all websites when the webbrowser c# application runs, if not then I have a list of websites whose read/write cookies operation should be disabled. I am using .NET 2.0 framework but can also use 4.5 回答1: You can't disable cookies only on your web browser control. The control is essentially an embedded Internet Explorer and shares

Scrolling WebBrowser programmatically sometimes doesn't work

谁都会走 提交于 2019-12-07 05:52:06
问题 I'm using the System.Windows.Forms.WebBrowser control and I need to do programmatically scrolling. For example, I use this code to scroll down: WebBrowser.Document.Body.ScrollTop += WebBrowser.Height The problem is that in some sites it works but in others it doesn't http://news.google.com (works good) http://stackoverflow.com/ (doesn't work) It's can be something about the body code, but I can't figure out. I've also tried: WebBrowser.Document.Window.ScrollTo(0, 50) but this way I don't know

How to change WebBrowser control User Agent in C# [closed]

怎甘沉沦 提交于 2019-12-07 05:46:17
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I am a beginner in using WebBrowser Control in C#. I try to change the User Agent string in a WebBrowser control in my Windows form. How can i do this ? Please Help. 回答1: You can set any additional headers in the

overriding GetSecurityId in IInternetSecurityManager

半腔热情 提交于 2019-12-07 04:35:52
问题 I have built an executable which launches a dialog box in which is embedded the IE web browser active-x control (C++). I want this control to allow cross site scripting. One frame on the web page loads local html, the other loads from a server. I then want the server page to call a javascript function that lives in the local html file. I am trying to achieve this by having the control implement it's own "IInternetSecurityManager" interface in which I am providing my own ProcessUrlAction and