Geolocation on NW.js returns error code 400

0 favourites
  • 5 posts
From the Asset Store
Two levels with two sistem Wave. with Source-code (.c3p) + HTML5 Exported.
  • Problem Description

    Hi everyone.

    When requesting the location with the native Geolocation plugin under an NW.js export or preview, the event "On error" triggers, the error message is:

    "Network location provider at 'https //' returned error code 400"

    This seems to be related to NW.js only.

    I googled the error message, some results said it's related to Google Chrome (would make sense, NW.js uses Chromium), but when previewing in Chrome (not NW.js), everything works.

    I'm no programmer, but I would assume, this problem is related to NW.js, not C2.

    But maybe there's a workaround to get it to work (apart from not using NW.js, obviously) without having to rely on an NW.js update.


    You can use the default Geolocation template.

    Description of Capx

    Testing the Geolocation plugin to its full content.

    Steps to Reproduce Bug

    • Use either action Request location or Track location
    • When previewing in or running the exported NW.js, On error will trigger
    • The expression Geolocation.ErrorMessage will be the above-mentioned message

    Observed Result

    See steps above.

    Expected Result

    The event On location update should trigger and the expressions Geolocation.Longitude and Geolocation.Latitude should return the approximate location.

    Affected Browsers

    • Chrome: (NO)
    • FireFox: (NO)
    • Internet Explorer: (NO)
    • NW.js: (YES)

    Operating System and Service Pack

    Windows 7 64bit, SP1

    Construct 2 Version ID

    Construct 2 r244, most current NW.js (v0.22.0 (Chromium 58)), released 20th of April 2017.

  • Found this post on the nw.js Github.

    I don't have a clue when it comes to javascript, can anyone make use of this and modify the Geolocation plugin?

  • Just run it through the ajax plug.

    Then load lastdata into something that can parse it like Yanns Json plug.

    This one:

    Came back with the wrong city, in the wrong state.

  • Thanks for the answer, this is actually almost what I ended up doing!

    With the only difference that I'm using this address now:

    It seemed more accurate to me.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I guess Google now block Geolocation from non-Chrome browsers. I added the workaround for the next build of C2 which looks like it works, hopefully they allow that one to keep running...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)