Gecko for windows forms and geolocation. How to accept request for share my location?

耗尽温柔 提交于 2019-12-11 06:06:10

问题


My main purpose is get my current geolocation. I've tried to do it with standart control "WebBrowser" but geolocation is not supported by it. So now I'm trying to implement Gecko wrapper https://code.google.com/p/geckofx/ and xulrunner-3.6.28.en-US.win32.sdk (or xulrunner-1.9.2.19.en-US.win32) to windows forms. It perfectly navigate to any url in windows forms. But I've problems to get current geolocation in it. It doesn't give me a window to accept "share my location" as any other browser does. How to do it? in wrapper using GeckoWebBrowser i've not seen any method or property to allow share location. So I think it should be made using xulrunner library. How I can do that? Or if it's very complicated with gecko, what another browser I can use in windows forms to be able to get my current geolocation?


回答1:


You will need to use a newer Geckofx

Also you need to ensure you exactly match the geckofx version with the correct xulrunner/firefox version.

GeoLocation doesn't yet have nice C# wrapper classes around it in geckofx, but you can access it using the xpcom C# interops.

var instance = Xpcom.CreateInstance<nsIGeolocationProvider>("@mozilla.org/geolocation/provider;1");

then look at the api



来源:https://stackoverflow.com/questions/16304380/gecko-for-windows-forms-and-geolocation-how-to-accept-request-for-share-my-loca

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!