Geolocation not working on my website


Website URL

i try to locate a user that click in button and i use a simple built in method to locate, but it don’t wanna working.
before I as sent files to the hosting i check website in liveserver and everything works well
here is a code to responsible to show latitude and longitude:\

    const bat = document.querySelector('.location')
       function fun() {      
            navigator.geolocation.getCurrentPosition(function (position) {
               bat.innerHTML =   position.coords.latitude + '<br>' + position.coords.longitude;;


    bat.addEventListener('click', fun)

any suggestions?

This works



this button below does not work because I assume it requires the HTTPS protocol


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.