mapquest-navigator / script.js
Arrel18's picture
The location using gmaps, so we can add in the maps
5c81fd5 verified
Raw History Blame Contribute Delete
680 Bytes
// Shared JavaScript functionality
document.addEventListener('DOMContentLoaded', () => {
// Check for geolocation support
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
console.log('User location:', position.coords.latitude, position.coords.longitude);
// You can center the map on the user's location here
},
(error) => {
console.error('Error getting location:', error);
}
);
} else {
console.log('Geolocation is not supported by this browser.');
}
// Any other shared functionality can go here
});