File size: 680 Bytes
5c81fd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// 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
});