Search code examples
androidcordovaphonegap-desktop-appw3c-geolocation

Powerful Features on Insecure Origins and Phonegap Desktop


I created a Phonegap project and I was testing it using Phonegap Desktop.

In the project I'm using Geolocation API.

In Chrome I'm getting

getCurrentPosition() and watchPosition() are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins for more details.

How can I configure Phonegap Desktop to make this work? What do I have to do make it work on an actual mobile?

I already added in config.xml:

<feature name="http://api.phonegap.com/1.0/geolocation"/>

Solution

  • I discovered that you can still use Phonegap Desktop, but instead of using the IP displayed on the server location, use localhost, like http://localhost:3000. Chrome does support Geolocation API without HTTPS for localhost.

    Then on the device everything is working fine.