Friday, 15 January 2010

javascript - Should I include the Google Map script tag on every page of my website? -


It seems that if I do not include script tags for Google Maps on every page of my website, I get it Error: "Unwanted reference error: Google is not defined" .

If I include a script tag on a page that has no map, then I get this error "Uncort Type Type: Property offsetwidth 'can not be empty . < / P>

Maybe I need a check system in JavaScript to see if this ID exists or not? I was not sure what the correct way to include Google Maps API?

This is my javascript What does it look like:
// Google Map

  Start the function () {var map • sheeting = document. GetElementById ('map-canvas'); var mapOptions = {center: new Google.maps.LatLng (44.5403, -78.5463), zoom: 8, map type EID: google.maps.MapTypeId.ROADMAP} var map = new google.maps.Map (mapCanvas, mapOptions)} google maps.event.addDomListener ( Window, 'load', start);  

  • On the page you want to use, map.

  • Do not include it somewhere else.

  • Fix your javascript to not do those things, which are not required. If you do not intend to render the map, do not write the code writing code.


No comments:

Post a Comment