设为首页收藏本站

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 153|回复: 0

Step by step guide to geolocation enabling your site

[复制链接]
发表于 2014-3-2 14:05:03 | 显示全部楼层 |阅读模式
Location detection with HTML5 is pretty simple. Browsers either support navigator.geolocation or they don't. If they do you can open up a whole world of local information to your users plus log a deeper and more geographic level of statistics server side.
         
  • JavaScript: Find out if navigator.geolocation is supported by the browser
  • JavaScript: If yes use the geolocation API to get the latitude and longitude values
  • JavaScript: Send latitude and longitude values to a server side script for processing
  • PHP: Query the Google Maps API to reverse geocode the latitude and longitude
  • PHP: Parse the resulting XML location data from the Google Maps API
  • PHP: Use these values to find local information to show your visitors. Could be from a database or remote API.
  • JavaScript: Update the page with data output by the server side script to offer your visitors local content!
                Download samples for free to add geolocation enable your website.

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2025-8-25 20:58 , Processed in 0.020465 second(s), 17 queries .

Supported by Best Deal Online X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表