[SOLVED] Use Geolocation without "Secure Origin"

Get help using Construct 2

Post » Fri Mar 31, 2017 3:04 pm

Within my game i want to show the current user location.
The problem is that since Chrome 50+something, Google wants apps, games and sites only to access from a secure origin, preferably via https.

The problem:
If you want to test out the geolocation within your game, within the game happens nothing. If you check the browser console, you see that Google informs you that Geoaccess, motion and much more is not availble from calls of unsecure origins.
And as your local server testing is at 192.168.xxx.xx, Google Chrome automatically defines it as unsecure.

The solution
This is how i manged it....
1. Open the Command line interpreter (CLI) in Windows. If you do know what this is go to Step 2
1.1. Go to the windows Start Menu
1.2. Imediately type in CMD, a black window pops up
2. In the Command Line move to your Chrome Folder by using the "dir", ".." and the "cd" commands
2.1. Find the chrome.exe somewhere in c:\program files\google\chrome\application
Type "dir" to show the whole directory content. If you see the chrome.exe then....

3. type this in: "chrome.exe --user-data-dir=/temp/ --unsafely-treat-insecure-origin-as-secure="http://192.xxx.x.x:50000"
The values herein defined by X must be YOUR GAME IP VALUES !
The best is to preview your game once and write down the number you see in the address bar.

As soon as you press ENTER on your keyboard, Chrome will start and inform you about some insecure stuff.
Start your game and voila: the Geolocation is shown.

What are my advantages now?
If you use the Chrome Developer tools you can change your Geolocation, orientation, gyroscope and much more from within he console. In other words: you can define your geolocation for London and after a refresh, your game will think that you are in London.

I am new to Construct 2 and do not know if this is a great solution, but it works for me.
Any questions please beneath this!
Hugs and greetings from this corner of the planet,
Posts: 14
Reputation: 1,028

Post » Fri Dec 29, 2017 11:34 am


super, just needed this!!!
Posts: 817
Reputation: 6,479

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests