I'm looking for some help making a modification to this code. I want to add a clickable link in the info window that pops up when you click on the marker. Right now I've got Name and Notes showing up, but can't seem to get a clickable URL. Any guidance would be greatly appreciated. Credit to the original code goes to
JasonSchroeder over at Corona.
Code:
------------------------
--REQUIRED VARIABLES
------------------------
local APIkey = "YOUR_API_KEY"
--This variable is your Google Maps API key (copy and paste it from the web). You can obtain a Google Maps API Key for free at http://code.google.com/apis/console
local lat, lon = 37.450876, -122.156689
--These are the latitude and longitude values where our map will center when it first loads.
local path = system.pathForFile( "map.html", system.DocumentsDirectory )
--This is the path for the HTML document that we'll create to load our custom Google Map.
------------------------
--OPTIONAL MARKER DATA
------------------------
local markerTable = {}
--This table will contain all of the data for our map markers.
markerTable[1]={
name = "Ansca HQ",
lat = 37.450876,
lon = -122.156689,
notes = "Play more. Code less."
}
markerTable[2]={
name = "Chipotle Mexican Grill",
lat = 37.4238658,
lon = -122.1433494,
notes = "Because Corona is even tastier with a burrito in your hand."
}
-- The above variables contain data for 2 markers. You can place additional markers, or attach other pieces of data to each marker (address, phone #, etc.)
local markerCode = {}
--This table will contain the compiled Javascript to place the markers we specified in the markerList table.
for i=1 , #markerTable do
markerCode[i] = [[
var infowindow]]..i..[[ = new google.maps.InfoWindow({
content: "<strong>]]..markerTable[i].name..[[</strong><br>]]..markerTable[i].notes..[["
});
var marker]]..i..[[ = new google.maps.Marker({
position: new google.maps.LatLng(]]..markerTable[i].lat..', '..markerTable[i].lon..[[),
map: map,
animation: google.maps.Animation.DROP,
});
google.maps.event.addListener(marker]]..i..[[, 'click', function() {
infowindow]]..i..[[.open(map,marker]]..i..[[);
});
]]
end
local markerString = table.concat(markerCode)
--The above code compiles a string that contains all of our marker data, to be inserted (optionally) into the HTML file we're creating.