diff --git a/web/index.html b/web/index.html index 1ab19a4..2e20acc 100644 --- a/web/index.html +++ b/web/index.html @@ -460,6 +460,33 @@ attribution: '© OpenStreetMap contributors', maxZoom: 19 }).addTo(map); + + // Try to get user's location + if (navigator.geolocation) { + navigator.geolocation.getCurrentPosition( + (position) => { + const lat = position.coords.latitude; + const lon = position.coords.longitude; + + // Add user location marker + const userIcon = L.divIcon({ + html: '
', + className: '', + iconSize: [16, 16], + iconAnchor: [8, 8] + }); + + L.marker([lat, lon], { icon: userIcon }) + .addTo(map) + .bindPopup('
Dein Standort
'); + + console.log('User location:', lat, lon); + }, + (error) => { + console.log('Geolocation error:', error.message); + } + ); + } } // Show status message