Javascript Html5 Geolocation Simple Example Not Working Stack Overflow

Javascript Html5 Geolocation Simple Example Not Working Stack Overflow In an extremely simple example i am trying to fetch co ordinates of user device and plotting the same on google maps in the web page. the example is simple and must run, but however i am finding an error. Html 5 geoloaction is working on ie9 but not in mozilla higher version and ie lower version so better use location by ip. i've had the same issues, my solution was to run geolocation from a wifi point of reference rather than ethernet.

Javascript Html5 Geolocation Simple Example Not Working Stack Overflow I have a simple map that should load centered around the user's location as long as they allow html5 geolocation. there's a function in place incase they don't choose to allow us to see their location, but for some reason it doesn't work. here's the code: var x = document.getelementbyid("msg"); function getlocation() { if (modernizr.geolocation) {. Here's the working example of your code. try to capture the error, to know why its not working. if (navigator.geolocation) { navigator.geolocation.getcurrentposition(positionfunction, showerror); } else { console.log("geolocation is not supported by this browser."); }); function positionfunction(p) { console.log(p.coords.longitude); };. I use this to geolocate the user and i need the values of currentlat and currentlon stored in a var: