Enable geolocation for local files on Mobile Chrome

半腔热情 提交于 2019-12-11 05:05:57

问题


I have quite similar question to this one, though concerning Mobile Chrome or any other browser that I can install on Android.

I've wrote a simple script using HTML5 geolocation feature, but it does not work neither in Mobile Chrome nor Android 4.1 system browser. In first one, my script returns "User denied" error code, though I did not denied anything (and though geolocation is enabled in Chrome settings). In system browser, status remains on "Idle" (startup value), which causes me to thing, that this poor browser isn't even HTML5-compatibily and does not supports jQuery, I used.

Because I want to develop a connection-less script (location basing on device's GPS only) I need any solution that I'm able to run on Android and that allows me to use geolocation from locally stored file (accessible via file:/// protocol). Anyone got any idea?


回答1:


As per the bug you linked to, geolocation and many other features are disabled for file:// URLs (just as in Chrome desktop). In regular Chrome, you can launch the browser with some useful flags like --allow-file-access-from-files, but no way to enable geolocation without running a local HTTPD.

For mobile Chrome, we are open to suggestions for new developer features. Please log this as a feature request on http://new.mcrbug.com.



来源:https://stackoverflow.com/questions/12409943/enable-geolocation-for-local-files-on-mobile-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!