Mapplets are small web applications that run within Google Maps. They are a
type of Google Gadget—the framework that allows developers to create small
web applications that can run within iGoogle, Google Maps, Orkut, or any web
page outside Google. Mapplets use the basic concepts and APIs of Google
Gadgets, though they are specifically used within the Google Maps realm.
In its basic form, a Mapplet is an XML file that contains the HTML and
JavaScript that make up your application. Mapplets have two components:
?? A web application that is displayed on the Google Maps site at
http://maps.google.com. This application is typically displayed in the lowerleft
corner of the page on http://maps.google.com.
?? JavaScript that lets you control the map on http://maps.google.com, retrieve
external data, or even store and retrieve user preferences.
After you create your Mapplet, it's up to you to host the Mapplet XML file
containing your HTML and JavaScript. When a user installs your Mapplet,
Google will grab the Mapplet XML file from your server and display it within an
<iframe> element on http://maps.google.com. (An <iframe> is an HTML element
that is used to embed HTML from another web site in a web page.) In this case,
Google uses an <iframe> element to embed your Mapplet in
http://maps.google.com.
Google will cache your Mapplet source and serve it from its own servers at
http://gmodules.com. This is done for a few reasons:
?? To restrict your Mapplet's JavaScript from doing anything harmful such as
accessing a user's cookies on http://maps.google.com
?? To reduce the load on your site from the potential high number of users you'll
have
You'll learn more about how to create Mapplets in this chapter, but before you
do, let's take a look at a live Mapplet. Open your browser to
http://maps.google.com/. Click the My Maps tab, and you will see a list of
Featured Content along with any maps you have created. Select the one about gas
prices, and you'll see a Mapplet in action. Figure 1-1 shows the Gas Prices from
GasBuddy.com Mapplet. This Mapplet consists of the application, at the bottom
of the left column, and all the map interaction. If the Gas Prices Mapplet is
available in your list of featured Mapplets, give it try—enter your ZIP/postal
code in the search box, and see what the gas prices are in your area.
type of Google Gadget—the framework that allows developers to create small
web applications that can run within iGoogle, Google Maps, Orkut, or any web
page outside Google. Mapplets use the basic concepts and APIs of Google
Gadgets, though they are specifically used within the Google Maps realm.
In its basic form, a Mapplet is an XML file that contains the HTML and
JavaScript that make up your application. Mapplets have two components:
?? A web application that is displayed on the Google Maps site at
http://maps.google.com. This application is typically displayed in the lowerleft
corner of the page on http://maps.google.com.
?? JavaScript that lets you control the map on http://maps.google.com, retrieve
external data, or even store and retrieve user preferences.
After you create your Mapplet, it's up to you to host the Mapplet XML file
containing your HTML and JavaScript. When a user installs your Mapplet,
Google will grab the Mapplet XML file from your server and display it within an
<iframe> element on http://maps.google.com. (An <iframe> is an HTML element
that is used to embed HTML from another web site in a web page.) In this case,
Google uses an <iframe> element to embed your Mapplet in
http://maps.google.com.
Google will cache your Mapplet source and serve it from its own servers at
http://gmodules.com. This is done for a few reasons:
?? To restrict your Mapplet's JavaScript from doing anything harmful such as
accessing a user's cookies on http://maps.google.com
?? To reduce the load on your site from the potential high number of users you'll
have
You'll learn more about how to create Mapplets in this chapter, but before you
do, let's take a look at a live Mapplet. Open your browser to
http://maps.google.com/. Click the My Maps tab, and you will see a list of
Featured Content along with any maps you have created. Select the one about gas
prices, and you'll see a Mapplet in action. Figure 1-1 shows the Gas Prices from
GasBuddy.com Mapplet. This Mapplet consists of the application, at the bottom
of the left column, and all the map interaction. If the Gas Prices Mapplet is
available in your list of featured Mapplets, give it try—enter your ZIP/postal
code in the search box, and see what the gas prices are in your area.
No comments:
Post a Comment