问题
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