Nicholas C. Zakas![]()
Featured ItemEven though the native geolocation API is in almost every new browser, there are a lot of older browsers without this capability. This module uses the native API where available and falls back to an IP lookup when not possible. If the native API call fails, the IP lookup is done as a fallback. This module honors the user's request not to share information, so if the native API call fails because the user denied permission, it will not attempt the IP-based lookup.
<script src="http://yui.yahooapis.com/3.4.0 PR2/build/yui/yui-min.js"></script>YUI({
//Last Gallery Build of this module
gallery: 'gallery-2011.10.20-23-28'
}).use('gallery-geo', function(Y) {
Y.Geo.getCurrentPosition(function(response){
//check to see if it was successful
if (response.success){
console.log(response.coords.latitude);
console.log(response.coords.longitude);
}
});
});| Subject | Author | Date |
|---|---|---|
| pidgets.geoip queries the wrong ip address | Steven Olmsted | 05/12/11 |
| Error in the example code & a fix | Alexander Shusta | 06/27/11 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info