关于IOS10系统内微信公众号地图的显示问题
来源:互联网 发布:什么是pdf软件 编辑:程序博客网 时间:2024/05/23 10:23
1.使用腾讯位置服务可以完美的解决问题,已使用测试;
2.具体的解决方案:
调用方式1:引用封装好的JS模块,调起前端的定位组件,通过封装好的接口获取位置信息。
js引入地址:https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
>
<title>前端定位模块</title>
<meta name=
"viewport"
content=
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
>
<style>
* {
margin: 0;
padding: 0;
border: 0;
}
body {
position: absolute;
width: 100%;
height: 100%;
text-align: center;
}
#pos-area {
background-color:
#009DDC;
margin-bottom: 10px;
width: 100%;
overflow: scroll;
text-align: left;
color: white;
}
#demo {
padding: 8px;
font-size: small;
}
#btn-area {
height: 100px;
}
button {
margin-bottom: 10px;
padding: 12px 8px;
width: 42%;
border-radius: 8px;
background-color:
#009DDC;
color: white;
}
</style>
<script type=
"text/javascript"
src=
"https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"
></script>
</head>
<body>
<div id=
"pos-area"
>
<p id=
"demo"
>点击下面的按钮,获得对应信息:<br /></p>
</div>
<div id=
"btn-area"
>
<button onclick=
"geolocation.getLocation(showPosition, showErr, options)"
>获取精确定位信息</button>
<button onclick=
"geolocation.getIpLocation(showPosition, showErr)"
>获取粗糙定位信息</button>
<button onclick=
"showWatchPosition()"
>开始监听位置</button>
<button onclick=
"showClearWatch()"
>停止监听位置</button>
</div>
<script type=
"text/JavaScript"
>
var
geolocation =
new
qq.maps.Geolocation(
"OB4BZ-D4W3U-B7VVO-4PJWW-6TKDJ-WPB77"
,
"myapp"
);
document.getElementById(
"pos-area"
).style.height = (document.body.clientHeight - 110) +
'px'
;
var
positionNum = 0;
var
options = {timeout: 8000};
function
showPosition(position) {
positionNum ++;
document.getElementById(
"demo"
).innerHTML +=
"序号:"
+ positionNum;
document.getElementById(
"demo"
).appendChild(document.createElement(
'pre'
)).innerHTML = JSON.stringify(position,
null
, 4);
document.getElementById(
"pos-area"
).scrollTop = document.getElementById(
"pos-area"
).scrollHeight;
};
function
showErr() {
positionNum ++;
document.getElementById(
"demo"
).innerHTML +=
"序号:"
+ positionNum;
document.getElementById(
"demo"
).appendChild(document.createElement(
'p'
)).innerHTML =
"定位失败!"
;
document.getElementById(
"pos-area"
).scrollTop = document.getElementById(
"pos-area"
).scrollHeight;
};
function
showWatchPosition() {
document.getElementById(
"demo"
).innerHTML +=
"开始监听位置!<br /><br />"
;
geolocation.watchPosition(showPosition);
document.getElementById(
"pos-area"
).scrollTop = document.getElementById(
"pos-area"
).scrollHeight;
};
function
showClearWatch() {
geolocation.clearWatch();
document.getElementById(
"demo"
).innerHTML +=
"停止监听位置!<br /><br />"
;
document.getElementById(
"pos-area"
).scrollTop = document.getElementById(
"pos-area"
).scrollHeight;
};
</script>
</body>
</html>
3.原创作品,请勿转载
0 0
- 关于IOS10系统内微信公众号地图的显示问题
- 关于在IOS10 系统上运行App 遇到的问题
- 关于iOS10的一些问题
- iOS10关于ATS的问题
- 关于android高德地图地图无法显示的问题
- iOS开发:iOS10.2手机系统打开相册遇到的各种显示英文文字的问题
- 关于iOS10的适配问题
- 公众号微信内置地图在ios上不显示问题
- 关于百度地图API显示地区范围控制的问题
- 关于高德地图不显示的问题
- 关于百度地图打正式包时不显示的问题
- android关于百度地图显示网格问题
- 关于iOS10相机崩溃问题
- 微信公众号中高德地图显示路线
- iOS10 调用系统相机拍照后黑屏的问题
- 解决iOS10不能跳转系统WiFi列表的问题
- 关于Xcode8 iOS10下模拟器NSLog不输出的问题
- Xcode8.0、iOS10.0关于推送的问题
- java简单克隆
- tomcat简介
- 在ubuntu上编译boost,boost的安装目录设置
- C++程序设计基础篇
- 设计模式-外观模式
- 关于IOS10系统内微信公众号地图的显示问题
- [学习笔记]jdk5.0新增特性
- RecyclerView的升级使用--------(二)
- 关于python编码问题无法读取GBK文件
- Java集合类List/Set/Map的区别和联系
- js数组
- 报错合集
- 正则表达式的数字实例
- 数据建模师的日常--踩坑与填坑