H5获取地理位置
来源:互联网 发布:长颈鹿美语待遇 知乎 编辑:程序博客网 时间:2024/05/27 00:49
H5获取地理位置
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" /> <title>H5获取地理位置</title> </head> <body> <script type="text/javascript"> if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(getLocation, showError); } else { alert("浏览器不支持") } // 返回经度和纬度 function getLocation(position) { lat = position.coords.latitude; lng = position.coords.longitude; alert(lat + "," + lng); } //处理错误和拒绝 function showError(error) { switch(error.code) { case error.TIMEOUT: alert("请求超时!请再试一次!"); break; case error.POSITION_UNAVAILABLE: alert('我们找不到你的位置 Sorry! ios10必须https才能访问定位'); break; case error.PERMISSION_DENIED: alert('请允许地理位置访问!'); break; case error.UNKNOWN_ERROR: alert('发生了未知错误!'); break; } } </script> </body></html>
阅读全文
0 0
- H5获取地理位置
- H5+GeoLocation获取地理位置
- H5 获取地理位置
- H5获取地理位置
- H5定位地理位置API
- H5地理位置信息
- h5和css3地理位置信息
- Android GPS获取地理位置
- Location获取地理位置信息
- 通过IP获取地理位置
- ios获取地理位置信息
- android获取地理位置信息
- 获取ip以及地理位置
- pray例子----------------------获取地理位置
- html5获取地理位置
- HTML5 Geolocation获取地理位置
- GPS获取地理位置
- html5 获取地理位置信息
- java泛型案例之电话簿
- java数据类型
- group by 多个字段
- 创建型-工厂模式(simple factory)
- js弹出框、对话框、提示框、弹窗总结
- H5获取地理位置
- 各主流浏览器内核判断
- free
- socfpga-3.12 编译方法
- 解析json格式字符串
- scala文件操作
- JavaScript中的call方法和apply方法
- J
- return 和 exit 的区别