【百度地图API】手机浏览器抓包工具及其使用方法
2012-03-13 18:51
405 查看
摘要:为了测试地图API在手机浏览器上的性能,需要给手机浏览器设置代理。通过代理,我们可以在PC上获取到抓包数据。进而对性能做进一步分析。
------------------------------------------------------
一、手机浏览器抓包工具
谷歌定位示例
------------------------------------------------------
一、手机浏览器抓包工具
谷歌定位示例
<!DOCTYPE html> <html DIR="LTR"> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps JavaScript API v3 示例:地图地理位置</title> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="http://code.google.com/apis/gears/gears_init.js"></script> <script type="text/javascript"> var initialLocation; var siberia = new google.maps.LatLng(60, 105); var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687); var browserSupportFlag =new Boolean(); var map; var infowindow = new google.maps.InfoWindow(); function initialize() { var myOptions = { zoom: 6, mapTypeId: google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Try W3C Geolocation method (Preferred) if(navigator.geolocation) { browserSupportFlag = true; navigator.geolocation.getCurrentPosition(function(position) { initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude); contentString = "Location found using W3C standard"; map.setCenter(initialLocation); infowindow.setContent(contentString); infowindow.setPosition(initialLocation); infowindow.open(map); }, function() { handleNoGeolocation(browserSupportFlag); }); } else if (google.gears) { // Try Google Gears Geolocation browserSupportFlag = true; var geo = google.gears.factory.create('beta.geolocation'); geo.getCurrentPosition(function(position) { initialLocation = new google.maps.LatLng(position.latitude,position.longitude); contentString = "Location found using Google Gears"; map.setCenter(initialLocation); infowindow.setContent(contentString); infowindow.setPosition(initialLocation); infowindow.open(map); }, function() { handleNoGeolocation(browserSupportFlag); }); } else { // Browser doesn't support Geolocation browserSupportFlag = false; handleNoGeolocation(browserSupportFlag); } } function handleNoGeolocation(errorFlag) { if (errorFlag == true) { initialLocation = newyork; contentString = "Error: The Geolocation service failed."; } else { initialLocation = siberia; contentString = "Error: Your browser doesn't support geolocation. Are you in Siberia?"; } map.setCenter(initialLocation); infowindow.setContent(contentString); infowindow.setPosition(initialLocation); infowindow.open(map); } </script> <style> body,html,#map_canvas{height:100%;width:100%;padding:0;margin:0;} </style> </head> <body onload="initialize()"> <div id="map_canvas"></div> </body> </html>
相关文章推荐
- 【百度地图API】手机浏览器抓包工具及其使用方法
- 【百度地图API】手机浏览器抓包工具及其使用方法
- 手机软件抓包工具及其使用方法
- mac中手机抓包工具Charles安装使用
- 使用OpenSSL工具制作X.509证书的方法及其注意事项总结
- Linux中tshark(wireshark)抓包工具使用方法详解
- 黑莓5.0系统手机通用断网修复工具-使用方法-mds地址
- Mac版手机网页抓包调试工具charles的使用
- Android 抓包工具使用方法
- PHPStorm设置xdebug工具调试php(使用浏览器或不使用浏览器两种方法)
- Fiddler抓包工具使用指南|手机安装Fiddler的安全证书
- 使用SpringMVC注解时浏览器开发者工具中出现404问题以及解决方法
- 使用OpenSSL工具制作X.509证书的方法及其注意事项总结
- Android使用adb工具及root权限完成手机抓包
- 网络抓包工具 - Fiddler使用方法
- weinre远程调试工具安装及其使用方法
- 抓包工具Fiddler的使用教程(十一):如何知道HTTP请求是POST方法还是GET方法
- fiddler 手机抓包工具的使用
- Android手机使用Fiddler方法介绍 手机抓包
- 使用抓包工具时手机连接代理步骤