Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6906521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:19:15+00:00 2026-05-27T08:19:15+00:00

I am try the Google Maps API and run into a little problem. Look

  • 0

I am try the Google Maps API and run into a little problem. Look at this example below. I want to have a Infobox open when I go to the site (not like in this example from google that it is cloesed and triggered by an click event). How to manage this? Maybe this is a beginners question to a Google Maps Api pro^^

>  function initialize() {
>     var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
>     var myOptions = {
>       zoom: 4,
>       center: myLatlng,
>       mapTypeId: google.maps.MapTypeId.ROADMAP
>     }
>  
>     var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
>  
>     var contentString = '<div id="content">'+
>         '<div id="siteNotice">'+
          'hello world</div>'+
>         '</div>';
>         
>     var infowindow = new google.maps.InfoWindow({
>         content: contentString
>     });
>  
>     var marker = new google.maps.Marker({
>         position: myLatlng,
>         map: map,
>         title: 'Uluru (Ayers Rock)'
>     });
>     google.maps.event.addListener(marker, 'click', function() {
>       infowindow.open(map,marker);
>     });   }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T08:19:16+00:00Added an answer on May 27, 2026 at 8:19 am

    Just add infowindow.open(map,marker); to the end of your initialize() function:

      function initialize() {
        var myLatlng = new google.maps.LatLng(-25.363882,131.044922);
        var myOptions = {
          zoom: 4,
          center: myLatlng,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
    
        var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    
        var contentString = '<div id="content">'+
            '<div id="siteNotice">'+
            '</div>'+
            '<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+
            '<div id="bodyContent">'+
            '<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
            'sandstone rock formation in the southern part of the '+
            'Northern Territory, central Australia. It lies 335&#160;km (208&#160;mi) '+
            'south west of the nearest large town, Alice Springs; 450&#160;km '+
            '(280&#160;mi) by road. Kata Tjuta and Uluru are the two major '+
            'features of the Uluru - Kata Tjuta National Park. Uluru is '+
            'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
            'Aboriginal people of the area. It has many springs, waterholes, '+
            'rock caves and ancient paintings. Uluru is listed as a World '+
            'Heritage Site.</p>'+
            '<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
            'http://en.wikipedia.org/w/index.php?title=Uluru</a> '+
            '(last visited June 22, 2009).</p>'+
            '</div>'+
            '</div>';
    
        var infowindow = new google.maps.InfoWindow({
            content: contentString
        });
    
        var marker = new google.maps.Marker({
            position: myLatlng,
            map: map,
            title: 'Uluru (Ayers Rock)'
        });
        google.maps.event.addListener(marker, 'click', function() {
          infowindow.open(map,marker);
        });
    
        infowindow.open(map,marker);
      }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having this problem: I have two Google maps in one page, showing just
I'm using Google Translate API, and if I try to translate Mc Donald's this
I get the following error when I try to run sample example of Google
I'm building an ASP.NET MVC site where I want to have a Google Maps
I've recently started looking at the Google Maps API to try out something new
I'm trying to solve a tricky problem in Google Maps (api V3) Works nicely:
I have the following code for google maps. The purpose of this code is
the google maps API require parameters like this : NSString *urlString=@http://maps.google.com/maps?saddr=43.2923,5.45427&daddr=43.4697,5.65427; [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlString]];
I'm kinda stuck with this problem on android. I created a maps API application,
I have some trobule using Google Maps API on Android. In onLocationChanged() I create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.