Artikel

Erweiterung zur Google Geolocation API

Wie bekannt, kann Google Geolocation API die geographischen Daten aufgrund der IP-Adresse anbieten, doch selbst für die entwickelten Länder zeigt sie oft keine Ergebnisse an. Auf die Anfrage des Nutzers wird einfach Null zurückgegeben.
Wir bieten hier eine kleine einfache Erweiterung zur Google API an.

Im Projekt soll nur ein kleines Script eingefügt werden:
<script type="text/javascript" src="http://api.wipmania.com/wip.js"></script>
Es enthält ein Objekt WIPlocation, dessen Format mit google.loader.ClientLocation übereinstimmt.

Dann soll der JavaScript Code mit folgendem ergänzt werden:
if (!google.loader.ClientLocation) {
 google.loader.ClientLocation = WIPlocation;
}

Nun, wenn Google die Lage nicht bestimmen konnte, anstatt "Unbekannt" bekommen Sie das Land des Nutzers.

Die Anzahl dieser Anfragen ist unbegrenzt.

Das Format google.loader.ClientLocation ist hier beschrieben.

Das Objekt WIPlocation hat eine weitere Eigenschaft:
WIPlocation.zoom - zoom level für das Land, das beim Anzeigen des Maps verwendet werden kann:
map.setCenter(new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitude), WIPlocation.zoom);

Anonymous/Name OpenID OpenID Yahoo! OpenID AOL WordPress LiveJournal TypePad Vox Myvidoop Orange Yandex YandexBlog Mixi Myspace Flickr Verisign MyOpenID ClaimID

Kein Feld ist Pflicht

Für den Hauptartikel bitte leer lassen.
Kommentar - 5000 Zeichen maximum. BBcode ist erlaubt

Abonnieren die Antworten: alle Kommentare:RSS comments (de)

Please have a look at our
Facebook Page and leave a comment

Creative Commons License
Creative Commons Attribution-Noncommercial 3.0 License