Wird google.loader.clientlocation weiterhin unterstützt
Habe ich einige tests mit google.loader.ClientLocation aus:
Aber ich bekomme null für den test:
if (google.loader.ClientLocation)
Dies ist das Verhalten, wenn google nicht finden-Informationen für IP.
Suchte ich StackOverflow und es gibt eine Menge von Fragen, aber keine guten Antworten.
Suchte ich im Netz und sah, wie diese 2 links:
- https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/8q_oG-Y9fp8
- http://code.google.com/p/google-ajax-apis/issues/detail?id=586
- https://groups.google.com/forum/?fromgroups=#!topic/google-ajax-search-api/rzoIh4RrtOQ
Die scheinen zu sagen, der navigator HTML geo-Standort verwendet werden soll.
Google-API-Dokumentation erwähnt es nicht mehr.
Ich hätte gerne eine Bestätigung, ob Google google.loader.clientlocation noch funktioniert oder nicht ?
Mein code ist der folgende:
<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
</head>
<body>
<script type="text/javascript">
function geoTest() {
if (google.loader.ClientLocation) {
var latitude = google.loader.ClientLocation.latitude;
var longitude = google.loader.ClientLocation.longitude;
var city = google.loader.ClientLocation.address.city;
var country = google.loader.ClientLocation.address.country;
var country_code = google.loader.ClientLocation.address.country_code;
var region = google.loader.ClientLocation.address.region;
var text = 'Your Location<br /><br />Latitude: ' + latitude + '<br />Longitude: ' + longitude + '<br />City: ' + city + '<br />Country: ' + country + '<br />Country Code: ' + country_code + '<br />Region: ' + region;
} else {
var text = 'Google was not able to detect your location';
}
document.write(text);
}
geoTest();
</script>
</body>
</html>
InformationsquelleAutor der Frage | 2013-01-07
Du musst angemeldet sein, um einen Kommentar abzugeben.
Scheint es diese API ist irgendwie "veraltet", obwohl es noch funktioniert für einige IPs.
Dies ist die Antwort, die ich von hier:
Also, wenn Sie den Ort nicht gefunden, IP, google.loader.ClientLocation null ist
InformationsquelleAutor der Antwort