marker metadata / opening infowindow

693 views
Skip to first unread message

Mike

unread,
Dec 7, 2012, 11:41:36 PM12/7/12
to google-map...@googlegroups.com
Hi, I have more of an approach question, than a code question.

Let's say I have 2 webpages (page a & page b) on the same domain.

User is on page a. They click a link. I'd like to take the user to page b, and open an info window.

My thought was to add some sort of id, or data attribute to a marker, and then, when the user gets to page B, an event fires opening the correct point/infowindow.

I read something about marker metadata:   marker.metadata = {type: "point", id: 1};

But I am confused at to what this actually does. In the resulting html/map, is the marker an element with this id?

Thanks in advance for any shedding of the light!

-Mike

Pil

unread,
Dec 8, 2012, 5:33:22 AM12/8/12
to Google Maps JavaScript API v3
No metadata!
You may assign any id you'd like to your marker objects.
Markers are objects and id's may be properties of them, so it's
possible to assign any property you may have in mind, for example

var marker = new google.maps.Marker();
marker.id = "myid";

Rossko

unread,
Dec 8, 2012, 6:57:48 AM12/8/12
to Google Maps JavaScript API v3
But a word of warning ... avoid clashes with the API internal marker
properties, which might take the form of marker.x or marker.ab and
also change from time to time. Just invent a property Google are
unlikely ever to use
marker.My_id
marker.Our_Metadata
Reply all
Reply to author
Forward
0 new messages