NW.js Geolocation problem

42 views
Skip to first unread message

Web SYS

unread,
Aug 26, 2021, 3:12:12 PM8/26/21
to nw.js
I'm getting error message when I try to get current position on my location using NW.js:

>  Error: Network location provider at 'https://www.googleapis.com/' : ERR_HTTP_RESPONSE_CODE_FAILURE

screenshot-picture_1630004460204.png
Reproducing the problem
  1. Go to https://nwjs.io/downloads/ to Download NWJS (select platform like Windows 32-bit/64-bit,  Linux 32/64-bit or Mac OS X 64-bit, then choose: NORMAL OR SDK VERSION) and click to download .zip archive.
  2. After download, click on the content archive file, select nwjs-sdk-v0.50.x-<os>-<arch> and Extract files to the specific path.
  3. Choose the destination (such as C:\nwjs) to make sure it will extract NW.js release files. 
  4. Go to C:/nwjs > nw.exe or call "C:\nwjs\nw.exe"  --url=https://www.google.com
  5. google "geolocation get current position", then go to https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
  6.  Open DevTools and select Console.
Javascript code:

`
var options = {
  enableHighAccuracy: true,
  timeout: 5000,
  maximumAge: 0
};

function success(pos) {
  var crd = pos.coords;

  console.log('Your current position is:');
  console.log(`Latitude : ${crd.latitude}`);
  console.log(`Longitude: ${crd.longitude}`);
  console.log(`More or less ${crd.accuracy} meters.`);
}

function error(err) {
  console.warn(`ERROR(${err.code}): ${err.message}`);
}

navigator.geolocation.getCurrentPosition(success, error, options);
`

What is wrong with it?

Web SYS

unread,
Aug 26, 2021, 3:14:54 PM8/26/21
to nw.js
I'm using NW.js on v0.55.0 now.
Reply all
Reply to author
Forward
0 new messages