I the case of "/Airspace.kml" I imagine the browser will try to fetch Airspace.kml off the root of the server. That won't work because you need the prefix that VRS is using (/VirtualRadar). If you need to path it from root then try "/VirtualRadar/Airspace.kml". If the page that references the file is already at the top level of the VRS site then just remove the leading /.
However, in the script I think you need an absolute URL for google.maps.KmlLayer. I would add a function that takes a relative path and turns it into an absolute path - add this bit right at the end of the script, just before the </script> tag:
Code: Select all
function formAbsoluteUrl(relativePath)
{
var result = window.location.href;
var lastSlashIdx = result.lastIndexOf('/');
return result.slice(0, lastSlashIdx) + relativePath;
}
Code: Select all
var ctaLayer = new google.maps.KmlLayer({
url: 'http://webpage.com/Airports.kml',
map: map
});
Code: Select all
var ctaLayer = new google.maps.KmlLayer({
url: formAbsoluteUrl('/Airports.kml'),
map: map
});