Using navigator.geolocation.getCurrentPosition() doesn't work.
-
Hello, I have been using Vivaldi for my full-stack classes and had never encountered any issues until today. When opening it from Visual Studio to check my code, and using this function that displays a map from Leaflet, it just doesn't work, or takes ages to load the map. I have been forced to use Chrome because it works flawlessly for this, but I hate it. What could be causing this issue? Any suggestions on how to fix it? Thanks in advance!
function getLocation() { navigator.geolocation.getCurrentPosition(position => { let myLat = position.coords.latitude; let myLong = position.coords.longitude; console.log(myLat, myLong); const map = L.map('map').setView([myLat, myLong], 13); L.tileLayer('https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}{r}.png', { maxZoom: 12, attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' }).addTo(map); }) } getLocation();