Link to home
Start Free TrialLog in
Avatar of Daniish
DaniishFlag for United Kingdom of Great Britain and Northern Ireland

asked on

My site experiences intermittent display problems that can be solved by re-refreshing - Can you help me fix this stability issue?

Hello,

My site is working and generally normally loads without any problems, however, sometimes when i refresh Firebug reports the following error (and none of my markers display):

map.addOverlay is not a function
http://www.globexposure.net/index_new.php
Line 164

If i keep refreshing it will eventually load properly - how can i resolve this?


Cheers
ASKER CERTIFIED SOLUTION
Avatar of b0lsc0tt
b0lsc0tt
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi there :)

It's just like b0lsc0tt said. The chance is that the function is called before the googlemaps API is loaded properly. I would suggest the you take the "onLoad" function  from the <body> tag and but it at the bottom above the </body> tag. Same goes for the "getMarkers()" function. Try to put it under the "onLoad()" function. If it still gives the same trouble, try calling "getMarkers()" from "onLoad()". "getMarkers()" should the be the last function called in "onLoad()".

I added a example.

Hope it helps :)
<noscript><b>JavaScript & Cookies must be enabled in order for you to use Google Maps.</b> 
      However, it seems JavaScript is either disabled or not supported by your browser. 
      To view Google Maps, enable JavaScript by changing your browser options, and then 
      try again.
</noscript>
 
<script type="text/javascript"> //This is the lines of code that may be added
  onLoad();
  getMarkers();
</script>
 
</body>
</html>

Open in new window

EZFrag,

Just a quick bit of info.  Positioning the script as you suggested (right above the body close tag) will run it before the onload event and can still error.  I am actually hoping the Asker is doing something like that so I recommended using the body's onload event.  That should be "run" after what you had.  At least from my experience.

Your suggestions is still good and I am definitely not trying to take from it.  I hope the Asker tries both. :)  Just wanted to give some info from my experience and knowledge that may even help you.  I still remember that method if I need but it always seems to be just before the onload (and sometimes too early).

Thanks for posting and your contribution here and on EE.  I hope this helps.

bol
I'm glad I could help.  Thanks for the grade, the points and the fun question.

bol