Tuesday, October 7, 2008 by Unknown

找 ip to location 解決方法的時候, 看到了這篇: APIs for Finding Location


原來 Google 提供了兩種找使用者位置的 APIs, 第一種是比較簡單的使用 ip address 去換. 使用的是 Google AJAX API 裡面多了一個 google.loader.ClientLocation 可以獲得位置的資料.

第二種比較精確的則是使用 Gears 0.4 之後的 Geolocation API 可以透過 ip/GPS 等方式來取得, 不過缺點是要安裝 Google Gears 目前並非每種瀏覽器都可以使用.




Filed under having 0 comments  

test snytax highlight

by Unknown

google.load("maps", "2");
google.load("search", "1");
google.setOnLoadCallback(function() {
var map = new google.maps.Map2(document.getElementById("map"));
map.setCenter(new google.maps.LatLng(
google.loader.ClientLocation.latitude,
google.loader.ClientLocation.longitude), 10);
});



這是一段
測試



google.load("maps", "2");

google.load("search", "1");

google.setOnLoadCallback(function() {

    var map = new google.maps.Map2(document.getElementById("map"));

    map.setCenter(new google.maps.LatLng(

        google.loader.ClientLocation.latitude,

        google.loader.ClientLocation.longitude), 10);

});


這段看起來應該會順眼一點

Filed under having 0 comments