簡體   English   中英

Gecko窗口不包含JSContext的定義

[英]Gecko Window doesnot contain a definition of JSContext

我的代碼是說Gecko Window不包含JSContext的定義

 string outString = ""; using (AutoJSContext js = new AutoJSContext((nsISupports)geckoWebBrowser1.Window.JSContext)) { js.EvaluateScript(@"window.alert('alert')", out outString); } 

您不需要AutoJSContext來評估腳本。 您可以嘗試以下操作:

myBrowser.Navigate("javascript:void(window.alert('alert'))")

在此處查看更多詳細信息https://bitbucket.org/geckofx/geckofx-45.0/issues/37/what-replaces-autojscontext

但是,如果確定需要AutoJSContext,則此方法仍然有效(Window是GeckoWindow ):

using (AutoJSContext context = new AutoJSContext(this.Browser.Window))
            {
                string result;
                context.EvaluateScript("window.find('',0,0,0,0,1,1)", out result);
            }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM