When I use navigator.geolocation in web page work but non in a chrome page of XUL Firefox Addon.
How use geolocation in XUL Addon?
geolocation in XUL addon
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: geolocation in XUL addon
Are you asking about WebExtensions or obsolete Legacy extensions?
Here is a WebExtension example that spoofs the navigator.geolocation object.
Geolocation (Location Guard)
http://addons.mozilla.org/firefox/addon/2699811
AMO search for Geolocation
http://addons.mozilla.org/firefox/search/?q=Geolocation
Here is a WebExtension example that spoofs the navigator.geolocation object.
Geolocation (Location Guard)
http://addons.mozilla.org/firefox/addon/2699811
AMO search for Geolocation
http://addons.mozilla.org/firefox/search/?q=Geolocation
-
- Posts: 779
- Joined: June 12th, 2008, 9:02 am
Re: geolocation in XUL addon
I query for obsolete Legacy extensions.
The above link not refere to GeoLocation query but to GeoLocation setting change.
The above link not refere to GeoLocation query but to GeoLocation setting change.
-
- Posts: 6437
- Joined: February 3rd, 2009, 6:29 pm
Re: geolocation in XUL addon
The following code snippet outputs the latitude and longitude using the browser console in Firefox 95.
Instructions:
* set devtools.chrome.enabled pref to true
* open browser console (ctrl+shift+j)
* copy and paste code into browser console
* press enter to run
Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line
Code: Select all
(function () {
new Promise(function (resolve, reject) {
var geolocation = Components.classes["@mozilla.org/geolocation;1"].
getService(Components.interfaces.nsISupports);
geolocation.getCurrentPosition(resolve, reject);
}).then(function (result) {
console.log("latitude: " + result.coords.latitude);
console.log("longitude: " + result.coords.longitude);
});
})();
* set devtools.chrome.enabled pref to true
* open browser console (ctrl+shift+j)
* copy and paste code into browser console
* press enter to run
Browser Console command line
http://developer.mozilla.org/docs/Tools ... mmand_line
Last edited by morat on December 19th, 2021, 7:08 pm, edited 1 time in total.
-
- Posts: 779
- Joined: June 12th, 2008, 9:02 am
Re: geolocation in XUL addon
Components.classes["@mozilla.org/geolocation;1"]
work, ty.
work, ty.