geckofx

How to call C# method in javascript by using GeckoFX as the wrapper of XULRunner

五迷三道 提交于 2019-12-05 09:51:26
I am using GeckoFX16 and xulrunner-16.0.2.en-US.win32 in my project. The thing is, I want to call a C# method in javascript. I am curious, is there a way to do this? Just like below: C# part: private GeckoWebBrowser weBrowser; public browser() { InitializeComponent(); Gecko.Xpcom.Initialize("xulrunner"); weBrowser = new GeckoWebBrowser(); weBrowser.Parent = this; weBrowser.Dock = DockStyle.Fill; weBrowser.Navigate("test.html"); } public string loadData(){ //load data from local file. return str; } javascript part: <script type='text/javascript'> var data = window.loadData(); alert(data); <

C# combining GeckoFX + Tor.NET libraries

随声附和 提交于 2019-12-04 18:14:11
I am trying to combine GeckoFx library and Tor.NET library. In my code I do all preparing to use tor network, ClientCreateParams createParameters = new ClientCreateParams(); createParameters.ConfigurationFile = ConfigurationManager.AppSettings["torConfigurationFile"]; createParameters.ControlPassword = ConfigurationManager.AppSettings["torControlPassword"]; createParameters.ControlPort = Convert.ToInt32(ConfigurationManager.AppSettings["torControlPort"]); createParameters.DefaultConfigurationFile = ConfigurationManager.AppSettings["torDefaultConfigurationFile"]; createParameters.Path = Path

Fill a select box using geckofx c#

北慕城南 提交于 2019-12-04 16:28:14
I am using the code: ((GeckoSelectElement) geckoWebBrowser1.Document.GetElementById("OA0001_dob_month")).Value = "Jul"; But its not working. How to select a value in a selectbox in geckofx c# without using the jscontext? To select a value by index: var document = GeckoWebBrowser1.Document; var selectElement = (GeckoSelectElement)document.GetElementById("OA0001_dob_month"); selectElement.SelectedIndex = 2; 来源: https://stackoverflow.com/questions/33259192/fill-a-select-box-using-geckofx-c-sharp

Setting cookies for the GeckoFX web browser?

倖福魔咒の 提交于 2019-12-04 15:39:14
How do you set the cookies for the Gecko web browser? I know that I have to call: geckowebbrowser.Document.Cookie = ...; but you need to set the cookies globally too. For example, in the .NET included Microsoft IE WebBrowserControl you set them by using the following Winapi function: static extern bool InternetSetCookie(string lpszUrl, string lpszCookieName, string lpszCookieData); This works fine for IE Web Browser but not for Gecko. I've tried to use the Cookiemanager class from the Gecko library by calling Cookiemanager.add(...) This worked for me with geckofx browser 29.0: string

Using GeckoFX in a multithreaded application

徘徊边缘 提交于 2019-12-02 12:17:58
问题 I'm having issues grasping how exactly to handle threads when using GeckoFX- it seems to throw errors constantly when trying to use the GeckoWebBrowser in other threads. Specifically what I'm trying to do in this test application is generate a thumbnail of a webpage and display it on a form (not the WebBrowser control itself). When working singlethreaded, it works great: private void browser_DocumentCompleted(object sender, EventArgs e) { GeckoWebBrowser browser = sender as GeckoWebBrowser;

Using GeckoFX in a multithreaded application

十年热恋 提交于 2019-12-02 05:18:25
I'm having issues grasping how exactly to handle threads when using GeckoFX- it seems to throw errors constantly when trying to use the GeckoWebBrowser in other threads. Specifically what I'm trying to do in this test application is generate a thumbnail of a webpage and display it on a form (not the WebBrowser control itself). When working singlethreaded, it works great: private void browser_DocumentCompleted(object sender, EventArgs e) { GeckoWebBrowser browser = sender as GeckoWebBrowser; if (browser.Url.ToString() != "about:blank") { webBrowserReady = true; } } private void btnGo_Click

C# How to get cookies from GeckoWebBrowser control

随声附和 提交于 2019-12-01 23:17:35
问题 I am using the GeckoWebBrowser control for navigate an URL. It actually should have cookies when that page is loaded. But if I tried to get the cookie, I get a blank text even the page is loaded. GeckoWebBrowser m_Browser = ... // ... after navigated. string sCookie = m_Browser.Document.Cookie.ToString(); Is there another way to get the cookies from GeckoWebBrowser? Please help me. Thanks 回答1: This is verified to work with GeckoFX v29.0. var uri = new Uri(txtURL.Text); //often cookies are

C# How to get cookies from GeckoWebBrowser control

久未见 提交于 2019-12-01 23:07:26
I am using the GeckoWebBrowser control for navigate an URL. It actually should have cookies when that page is loaded. But if I tried to get the cookie, I get a blank text even the page is loaded. GeckoWebBrowser m_Browser = ... // ... after navigated. string sCookie = m_Browser.Document.Cookie.ToString(); Is there another way to get the cookies from GeckoWebBrowser? Please help me. Thanks This is verified to work with GeckoFX v29.0 . var uri = new Uri(txtURL.Text); //often cookies are stored on domain level, so ".google.com", not "www.google.com" (leading dot is important) string host = uri

GeckoWebBrowser access an incorrect URL,Always pop up message box

隐身守侯 提交于 2019-12-01 20:41:46
问题 www.addssds333fdsd.com.cn could not be found. Please check the name and try again. GeckoWebBrowser _webA = new GeckoWebBrowser(); _webA.Navigate("www.addssds333fdsd.com.cn"); When I Access An incorrect URL,Application will pop up message box. How to catch the Exception or drop the message box. 回答1: You need to implement the nsIPromptServcice2 and nsIPrompt interfaces There you will get a list of methods (e.g. Alert(); ) where you simply don't provide an implementation. That will 'catch' the

GeckoWebBrowser access an incorrect URL,Always pop up message box

我的梦境 提交于 2019-12-01 18:56:43
www.addssds333fdsd.com.cn could not be found. Please check the name and try again. GeckoWebBrowser _webA = new GeckoWebBrowser(); _webA.Navigate("www.addssds333fdsd.com.cn"); When I Access An incorrect URL,Application will pop up message box. How to catch the Exception or drop the message box. You need to implement the nsIPromptServcice2 and nsIPrompt interfaces There you will get a list of methods (e.g. Alert(); ) where you simply don't provide an implementation. That will 'catch' the exception. Create a following class (you will need to provide implementation for a bunch of methods, such as