2

I have a Spring Mvc web app, placed on a Tomcat server on my localhost. In one of the pages, I'm using this code, available on Fiddle

On Pc it works, but on my phone(Google Chrome), it's not asking for permission, it's denying instantly. Also checked on Chrome, and my app does not appear on blocked app, at location tab.

If I access that fiddle on my phone, it's asking for permission and it's working.

But on my 192.168.0.xyz:8080/myapp ,the permission is denied by default. How can I solve this problem?

Also, I tried 192.168.0.xyz:8080/myapp on mozzila(android) and default android web browser and it's asking for my permission. I don't know why chrome(android) is refusing my app for location-, but chrome(pc) works fine..

LE: I tried my app from 2 more android devices, still, the same result!

Community
  • 1
  • 1
user6346756
  • 59
  • 11
  • try to clear the cache since you might have declined it in the past. also you need to check the settings of the browser, for me it works normally. – Bamieh Jun 05 '16 at 11:17
  • I don't think it has something to do with that, because I tried my app from 2 more android devices, still, the same result! – user6346756 Jun 05 '16 at 11:19
  • I'm not sure then, but you can check this answer:http://stackoverflow.com/a/17441771/5384679 – Bamieh Jun 05 '16 at 11:34
  • I'm getting permission denied, not timeout. So..that link is not helping – user6346756 Jun 05 '16 at 11:37

2 Answers2

0

I partially solved it. I think it's a bug of Google... Uninstalled all Google Chrome's updates, and now it's asking for permission

user6346756
  • 59
  • 11
0

Note: As of Chrome 50, the Geolocation API will only work on secure contexts such as HTTPS. If your site is hosted on an non-secure origin (such as HTTP) the requests to get the users location will no longer function.

Source (www.w3schools.com) (web.archive.org)

A more easier solution is to setup a port forwarding between your computer and your phone so you don't need to use HTTPS. How to do it

You should therefore install a local HTTPS web server or use a service that offers HTTPS hosting like Netlify which hosts your web app for free.

Spixz
  • 131
  • 2
  • 8