Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  179] [ 3]  / answers: 1 / hits: 23234  / 11 Years ago, thu, march 14, 2013, 12:00:00

I'm working on a website that uses the DotNetNuke CMS. I've added a Google Maps map using the API, but I need to call the initialize() function when the page has loaded. Usually you'd do this with:

<body onload=initialize()>

or add the following just before the < /body> tag:

<script type=text/javascript>
window.onload = function () {

I however do not have access to the body tag, or exact end of the tag. Is there any other way to call this function without doing the aforementioned?

More From » jquery


Not a good idea to do this on a window load event - if you've got some high-latency images or other assets loading then your google map will load very slowly. Just before the closing body tag, add this:


All that google needs to be ready before it builds it's map is the DOM, not every single asset on the page. The DOM is always fully loaded by the time the script loads right before the closing body tag.


Technically, all that google maps needs to be ready before it builds it's map is the div that it is going to be placed in. So you don't even need to have the script before your closing body tag, you could have it immediately after your map div tag like this:


<div id=map-canvas></div>

...more html

[#79595] Wednesday, March 13, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 415
Total Questions: 117
Total Answers: 94

Location: American Samoa
Member since Fri, Aug 26, 2022
2 Years ago