1

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?

Mirvel
  • 143
  • 2
  • 11

1 Answers1

0

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

Tom
  • 6,325
  • 4
  • 31
  • 55
  • +1. But truly say I don't understand how to use it. I still can't get geolocation in var instance = Xpcom.CreateInstance("@mozilla.org/geolocation/provider;1"); i see only some methods "startup" "sethighaccuracy" "watch" and others. But there is no method to get geolocation. And I've also an error while I'm trying to lunch with new wrapper Gecko 18, but simple GeckoWebBrowser throws exception on my code: – Mirvel May 02 '13 at 03:30
  • Xpcom.Initialize(@"D:\zDownloads\xulrunner-3.6.28.en-US.win32.sdk\xulrunner-sdk\bin"); Gecko.GeckoWebBrowser wb = new Gecko.GeckoWebBrowser(); Unable to cast COM object of type 'System.__ComObject' to interface type 'Gecko.nsIComponentManager'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{1D940426-5FE5-42C3-84AE-A300F2D9EBD5}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)). – Mirvel May 02 '13 at 03:34
  • you need to use xulrunner 18 with geckofx 18. If you use the wrong version you will get lots of "Unable to cast COM objects" type exceptions. – Tom May 02 '13 at 13:05