Skip to content

[Bug]: the plugin not works on web #81

@losciur

Description

@losciur

Current Behavior

When I use the plugin on web with a classical request:

var geo_options = {
        enableHighAccuracy: true,
        maximumAge: 600000,
        timeout: 4500
      };
var resGeolocation = await Geolocation.getCurrentPosition(geo_options)
console.log("Geolocation.getCurrentPosition", resGeolocation)

I got on console:

GeolocationPositionError { code: 3, message: "Position acquisition timed out" }

or, in other cases:

GeolocationPositionError { code: 1, message: "User denied Geolocation" }

even if I gave the permission (when the borwser asks me).

To check, I tried also:

 var permission = await Geolocation.checkPermissions()
 console.log("Geolocation.checkPermissions", permission)

I got

{
  "location": "prompt",
  "coarseLocation": "prompt"
}

Tested on Firefox, Chrome, Edge and Safari.

No error if I use it on Android or iOS app.

Expected Behavior

To obtain the current position.

Reproduction

no link

Screenshots / Media

No response

Environment Details

ionic info:

Ionic:

   Ionic CLI                     : 7.2.1
   Ionic Framework               : @ionic/angular 8.8.4
   @angular-devkit/build-angular : 20.3.24
   @angular-devkit/schematics    : 20.3.24
   @angular/cli                  : 20.3.24
   @ionic/angular-toolkit        : 12.3.0

Capacitor:

   Capacitor CLI      : 8.3.1
   @capacitor/android : 8.3.1
   @capacitor/core    : 8.3.1
   @capacitor/ios     : 8.3.1

Utility:

   cordova-res : not installed globally
   native-run  : 2.0.3

System:

   NodeJS : v24.13.1
   npm    : 11.8.0
   OS     : macOS

and:  "@capacitor/geolocation": "^8.2.0",

Versions Affected

8.2.0

Platforms Affected

  • iOS
  • Android
  • Web

Notes / Comments

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions