本帖最后由 a609271631 于 2022-3-24 13:17 编辑
有大神发下教程吗?
非ip定位
非公众号
活字格如何从iframe下面的html代码中实时提取"geoResult"定位数据???
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<title>腾讯地图 - 前端定位组件</title>
<link rel="stylesheet" href="//mapapi.qq.com/web/mapComponents/geoLocation/v/static/geolocation/static/css/geolocation_c55a9bf.css" /><link rel="stylesheet" href="//mapapi.qq.com/web/mapComponents/geoLocation/v/static/geolocation/widget/loading/zoom/zoom.inline_d0b13c4.css" /></head>
<body >
<p id="geoResult">定位中....</p>
<div id="zoom" class="mod model-1">
<div class="spinner"></div>
</div>
</div>
<script type="text/javascript" src="//mapapi.qq.com/web/mapComponents/static/common/static/js/mod_0d3c97a.js"></script><script type="text/javascript" src="//mapapi.qq.com/web/mapComponents/geoLocation/v/static/geolocation/static/pkg/geolocation_libs_de092c0.js"></script><script type="text/javascript">!function() {
window.listener.on('common.geolocation', 'success', function(evt, loc) {
var result = loc.addr || loc.city;
document.getElementById('geoResult').innerHTML = result;
document.getElementById('loading').className = 'fadeout';
});
window.listener.on('common.geolocation', 'fail', function() {
document.getElementById('geoResult').innerHTML = '定位失败';
document.getElementById('loading').className = 'fadeout';
});
window._prStat = require('geolocation:static/js/util/stat.js');
window._prStat.init({
appId: 'mc_geolocation',
statService: '//pr.map.qq.com/pingd',
from: 'myapp'
});
require('geolocation:static/js/boot.js').init({key: '', initgeo: true, debug: 0, clearCache: 0, locType: ''});
}();</script></body>
</html> |
|
|