Hacking Google Maps and Google Earth (ExtremeTech)

(Dana P.) #1

Chapter 3: The Google Maps API


Browser Compatibility


Google Maps is compatible with the same browsers and environments as Google Local (see
Chapter 2). This covers the vast majority of the web browsing environments available. Other
browsers might or might not support the Google Maps API. The Google Maps API is con-
stantly changing as it is improved and updated. It is inevitable that some occasional problems
will manifest themselves. Any significant difficulties should be reported to Google.

In your HTML page you can check whether the current browser is compatible with the Google
Maps system through the GBrowserIsCompatiblefunction in the Google Maps API.
Ideally you should check the return value of this and report any known incompatibility to the
user.

Basic Components of a Google Maps Application


The key to the Google Maps API is the JavaScript component that is loaded from Google
each time you open a Google Maps web page. This JavaScript component provides the inter-
face to the Google Maps service and generates the map onscreen by loading the necessary
image components and tiling them onto the display.

Further customization and extension of these components is what makes a custom Google
Maps application.

XHTML (Extensible HTML)


Google Maps will work in any standard HTML page, but Google recommends that you create
pages that are compliant with the XHTML standard. This will ensure not only that the
HTML is compatible with the standard to which most browsers are now also made compati-
ble, but also the reliable rendering of your web page on as wide a range of web sites as possible.

For this reason, you should make sure that your XHTML pages are correctly marked up as
XHTML. Listing 3-1 shows a simple XHTML-compatible page template.

Listing 3-1:XHTML Page Template

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>XHTML Page</title>
</head>
<body>
</body>
</html>
Free download pdf