Developing for Mobile Devices

The Google Maps JavaScript API has been designed to load quickly and work well on mobile devices. In particular, we have focused on development for advanced mobile devices such as Android and iOS handsets. Mobile devices have smaller screen sizes than typical browsers on the desktop. As well, they often have particular behavior specific to those devices (such as "pinch-to-zoom"). If you wish to have your application work well on mobile devices, we recommend the following:

  • Set the <div> containing your map to have width and height attributes of 100%. Be aware that some older desktop browsers don't display well with these values, however.
  • You can detect iPhone and Android devices by inspecting the navigator.userAgent property within the DOM:
    function detectBrowser() {
      var useragent = navigator.userAgent;
      var mapdiv = document.getElementById("map");
      if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) { = '100%'; = '100%';
      } else { = '600px'; = '800px';

    This allows you to alter layout for particular devices, as we've done here to change the screen real estate for each device.

  • Android and iOS devices respect the following <meta> tag:

    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />

    This setting specifies that the map should be displayed full-screen and should not be resizable by the user. Note that the iPhone's Safari browser requires this <meta> tag be included within the page's <head> element.

For more information on development for the iPhone, consult Apple's Developer documentation. For more information on development for Android devices, consult the Android documentation.


You may localize your Maps API application both by altering default language settings and by setting the application's region code, which alters how it behaves based on a given country or territory.

Language Localization

The Google Maps API uses the browser's preferred language setting when displaying textual information such as the names for controls, copyright notices, driving directions and labels on maps. In most cases, this is preferable; you usually do not wish to override the user's preferred language setting. However, if you wish to change the Maps API to ignore the browser's language setting and force it to display information in a particular language, you can add an optional language parameter to the <script> tag when including the Maps API JavaScript code, specifying the language to use.

For example, to display a Maps API application in Japanese, add &language=ja to the <script> tag as shown below:

<script src=""

Note: loading the API in the manner shown above will use the Japanese language for all users regardless of user preferences. Be sure you wish this behavior before setting this option.

View example (map-language.html)

The Maps Javascript API also supports Bi-directional (Bidi) text containing characters in both Left-to-Right (LTR) and Right-to-Left (RTL) languages natively. Examples of RTL languages include Arabic, Hebrew and Farsi. Generally, you should specify RTL language pages to render properly by adding dir='rtl' to the page's <html> element. The following example renders a map of Cairo, Egypt using Arabic controls:

View example (map-rtl.html)

See also the supported list of languages. Note that we often update supported languages so this list may not be exhaustive.

Region Localization

When you load the Maps API from it applies a default bias for application behavior towards the United States. If you wish to alter your application to serve different map tiles or bias the application (such as biasing geocoding results towards the region), you can override this default behavior by adding a region parameter to the <script> tag when including the Maps API JavaScript code.

As the developer of a Maps API application it is your responsibility to ensure that your application complies with local laws by ensuring that the correct region localization is applied for the country in which the application is hosted.

The region parameter accepts Unicode region subtag identifiers which (generally) have a one-to-one mapping to country code Top-Level Domains (ccTLDs). Most Unicode region identifiers are identical to ISO 3166-1 codes, with some notable exceptions. For example, Great Britain's ccTLD is "uk" (corresponding to the domain while its region identifier is "GB."

For example, to use a Maps API application localized to the United Kingdom, add &region=GB to the <script> tag as shown below:

<script type="text/javascript" src=""

The following examples show two maps, one which geocodes "Toledo" based on the default region (US) to "Toledo, Ohio" and one which biases results based on a region set to ES (Spain) to "Toledo, Spain."

Loading the API in China

The Google Maps APIs are served within China from When serving content to China, replace with For example:

<script src=""

If you are specifically targeting users in China, you may wish to add the region and language parameters as well. The API supports both zh-CN and zh-TW as values for the language parameter.

<script src=""


The Google Maps JavaScript API team regularly updates the API with new features, bug fixes, and performance improvements. You can indicate which version of the API to load within your application by specifying it in the v parameter of the Google Maps JavaScript API bootstrap request. Read more about versioning.

Feedback verzenden over...

Google Maps Javascript API
Hulp nodig? Ga naar onze ondersteuningspagina.