I need to get the current location so I used the Get user’s location actions in Weweb and I saw the actions deprecated so Do I need to add the PWD plugin to my project?
Thank you guys!
I need to get the current location so I used the Get user’s location actions in Weweb and I saw the actions deprecated so Do I need to add the PWD plugin to my project?
Thank you guys!
Welcome to the community, Bill!
Yes, that’s correct. You need to add the PWA plugin and call its Geolocate action.
My problem is solved.
I use custom javascript to retrieve a value an update into a variable.
// Check if geolocation is supported
if (navigator.geolocation) {
// Request the current position
navigator.geolocation.getCurrentPosition(successFunction, errorFunction);
} else {
console.log(“Geolocation is not supported by this browser.”);
}
// Success callback for getCurrentPosition
function successFunction(position) {
// Extract latitude and longitude from the position object
const latitude = position.coords.latitude;
const longitude = position.coords.longitude;
// Update global variables
variables[‘d5437be2-f634-4178-b4b1-285db4840d0a’] = latitude;
variables[‘7a971419-b0e4-4047-9a4d-e5a8120be0f4’] = longitude;
// Return the updated latitude and longitude
return { latitude, longitude };
}
// Error callback for getCurrentPosition
function errorFunction() {
console.log(“Unable to retrieve your location.”);
return null;
}
Thank you Danlopes!
It’s much easier.
Yes - Many thanks