Find coordinates of current location

How to find Geo location coordinates of current position in ionic 1
I found much many solutions but no one is working in my app
’ [object PositionError] ’ error is occurring when it is running in browser

'Only secure origins are allowed (see: https://goo.gl/Y0ZkNV)." ’ is also an error

   $scope.getLocation = function () {
  var posOptions = { timeout: 10000, enableHighAccuracy: false };

    $cordovaGeolocation.getCurrentPosition(posOptions).then(function (position) {
        var lat = position.coords.latitude
        var long = position.coords.longitude
        console.log(lat + '   ' + long)
    }, function (err) {
        console.log(err)
    });

    var watchOptions = { timeout: 3000, enableHighAccuracy: false };
    var watch = $cordovaGeolocation.watchPosition(watchOptions);

    watch.then(
       null, function (err) {
           console.log(err)
       }, function (position) {
           var lat = position.coords.latitude
           var long = position.coords.longitude
           console.log(lat + '' + long)
       }
    );

    watch.clearWatch();
}

this is my code