问题描述
微软的可以用window.external很方便的调用c#函数那么gecko里面怎么调用呢查了一天资料...........跪谢了...
解决方案
解决方案二:
人工置顶人工置顶
解决方案三:
解决方案四:
readgeckoMDN"EmbeddingTips"IneedtheJavaScriptinsidethebrowserwindowtotalktomyembeddingclient.HowdoIdoit?AtstartupusethecategorymanagertoregisterpropertiesoftheglobalobjectinJavaScriptlikethis:nsCOMPtr<nsICategoryManager>catman=do_GetService(NS_CATEGORYMANAGER_CONTRACTID);if(!catman)returnNS_ERROR_FAILURE;nsXPIDLCStringprevious;catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,"my_prop_name","my_prop_contract_id",PR_TRUE,PR_TRUE,getter_Copies(previous));Thiswillcauseacomponentwiththecontractidmy_prop_contract_idtobelazilycreatedwhenthemy_prop_nameisresolvedinanyJavaScriptwindowscope.Ifyouwanttocreateyourcomponentmultipletimeswithinthebrowserwindow,youcanuseaJavaScriptconstructorinsteadofaJavaScriptproperty:catman->AddCategoryEntry("JavaScriptglobalconstructor","my_prop_name","my_prop_contract_id",PR_TRUE,PR_TRUE,getter_Copies(previous));Thatwayyouwillbeabletodo:varmy_comp=newmy_prop_name();ThiswastakenfromWeirdAl'sexcellent"BurningChrome"article.notaboutc