HTML and CSS Reference
In-Depth Information
Figure 2-1. Our skeleton story in Safari
Muffin Bukowski was roused from decadent slumber by the
ear-throttling shriek of an unidentified avian trespassing on the
grounds of her otherwise-serene home, clearly violating Section I,
Article 246 of her condo documents.</p>
<p>Groggily stumbling to her bedroom window, Muffin peered
through the pristine glass out at <em id="street_address">LOADING STREET
NAME</em>.</p>
<p>&#8220;Are my eyes deceiving me?&#8221; Muffin muttered as she lightly
rapped her knuckles against her forehead, unable to process the
miraculous scene unfolding before her...</p>
</body>
</html>
Now, we'll need some JavaScript code to do the following:
1. Query the Geolocation API for the reader's latitude and longitude
2. Use the latitude and longitude values to then query the GeoNames database for
the reader's current temperature, and fill in the corresponding placeholder in the
story.
3. Use the latititude and longitude values to query GeoNames for the reader's street
address and city, and again fill in the corresponding placeholders.
GeoNames has several dozen web services available for getting different types of geo-
graphical data. For our example, we can use their extendedFindNearby service to get
street-address and city data, and their findNearByWeather service to get the temperate
data. For most of their web services, GeoNames makes data available in both XML and
JSON formats, but in the case of extendedFindNearby , only XML data is available. So,
to make things simple, we'll query both services for XML. And to make things even
 
Search WWH ::




Custom Search