Tuesday, July 22, 2008

Drop a Google Map Onto Your Site

Take your Google map and run, freeing it from its usual home at the maps.google.com domain.

The easiest way to embed a Google map on your own site is available directly from http://maps.google.com. Just point to any location—you can also zoom in and switch to satellite view, for instance—and then click "Link to this page" on top. A dialog will open that allows you to copy an HTML portion to be pasted into your own site. You can also customize the map size by clicking the "Customize" link in this dialog.

The actual code you end up with consists of an inline frame, among other things. An inline frame is a window within the browser window that contains an external site's service; in this case, Google Maps.

NOTE

If you are concerned about using HTML that validates, you need to adjust some of Google's HTML attributes, and also set your document type to "transitional." To validate your HTML, enter your home page address into the official validator provided by the World Wide Web Consortium at http://validator.w3.org. This can help alert you to syntax errors in your code. To learn more about HTML and CSS, visit http://w3.org/TR/html4/ and http://w3.org/TR/CSS21/ respectively.


No comments: