To center google map to current user location using js api, you first have to make your website a HTTPS site
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
map.setCenter(pos);
}, function () {
console.log('error gis');
});
}
more details here
