Step-by-Step Guide to Embedding a Baidu Map with an Inline Frame

This tutorial walks you through creating a Baidu map, configuring its center and markers, obtaining the embed code, inserting it into an HTML file, applying your API key, and publishing the final page, all with clear visual instructions.

AI Software Product Manager
AI Software Product Manager
AI Software Product Manager
Step-by-Step Guide to Embedding a Baidu Map with an Inline Frame

1. Insert an inline frame (iframe) into your page, set its scrollbars to never display, hide the border, and use a preview image that represents the map.

Create the map using the Baidu Map generator. Specify the central point by entering the city and location.

Image
Image

Adjust map settings as needed (zoom level, map type, etc.).

Image
Image

Add markers to highlight specific locations on the map.

Image
Image

Obtain the embed code from the generator and copy it.

Image
Image

Create a new file named baidumap.html on your desktop and paste the copied code into it.

Image
Image

Register as a developer on the Baidu Map Open Platform, activate your account via email, and obtain an API key (AK).

Image
Image

Replace the placeholder after ak= in baidumap.html with your actual key.

Image
Image

Double‑click the inline‑frame link to open baidumap.html and verify the map displays correctly.

Image
Image

Publish the project: generate the final HTML files, move baidumap.html into the generated HTML folder, and open start.html to see the integrated map.

Image
Image

Following these steps results in a fully functional Baidu map embedded via an iframe, ready for inclusion in any web page.

Web developmentHTMLiframeAPI keyfrontend tutorialBaidu Map
AI Software Product Manager
Written by

AI Software Product Manager

Daily updates of Xiaomi's latest AI internal materials

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.