it has been long time trying to get a working code , to make that working , but i cannot , , all what i need that if a visitor joined my website and want to submit a contact form , is that the country and area code ,autofilled via the geo ip address visitor , so pls who can help me ?
import wixWindow from 'wix-window';
$w.onReady(()=>{console.log('Page ready...');
wixWindow.getCurrentGeolocation().then( (obj) => {
let timestamp = obj.timestamp; console.log(timestamp);
let latitude = obj.coords.latitude; console.log(latitude);
let longitude = obj.coords.longitude; console.log(longitude);
let altitude = obj.coords.altitude; console.log(altitude);
let accuracy = obj.coords.accuracy; console.log(accuracy);
let altAccuracy = obj.coords.altitudeAccuracy; console.log(altAccuracy);
let heading = obj.coords.heading; console.log(heading);
let speed = obj.coords.speed; console.log(speed);
})
.catch( (error) => {let errorMsg = error;});
});
Try this one and take a look onto RESULTS in your CONSOLE!
will try it thank you my friend ,but isnt need an api ?
no bro nothing only a page readey… in the consol anyway i need to be autotodetect country and area code in the registration form