You said, "It waits for the document to have a `<body>`..." and in the code you link to, it appears to be a googlemaps specific requirement to have the body loaded first.  Is that a check I should be making?