Html5 geographical positioning

HTML5 Geolocation

HTML5 Geolocation is used to locate the user's location.

Positioning the position of the user

## HTML5 Geolocation API is used to obtain the user's geographical location.

Given that this feature may violate user privacy, user location information is not available unless the user agrees.

# browser supports


Aterent Explorer 9+, Firefox, Chrome, Safari and Opera support Geolocation (geographical positioning).

Note: Geolocation (geographical positioning) For devices with GPS, such as iPhone, geographical positioning is more accurate.

Qi test whether the browser supports:

if (navigator.geolocation) { //console.log("浏览器支持!"); }else { // console.log("浏览器不支持!"); }

Navigator.Geolocation is used to obtain the current user geographical location of the browser -based, provided 3 Method:

RrreerReeeHandling errors and rejection of

# stertcurrentposition () method for handling errors. It specifies the function to be run when obtaining the user's location fails:

Instance

void getCurrentPosition(onSuccess,onError,options);//获取用户当前位置 int watchCurrentPosition(onSuccess,onError,options);//持续获取当前用户位置 void clearWatch(watchId);//watchId 为watchCurrentPosition返回的值//取消监控

###
Continuing Learning
||
php中文网(php.cn)

点击按钮获取您当前坐标(可能需要比较长的时间获取):

submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!