Solved

Google Maps API and Javascript problem.  It works perfectly in Firefox, WHY NOT Internet Explorer?

Posted on 2008-10-23
9
725 Views
Last Modified: 2013-12-08
I have implemented the Google Maps API and some javascript to create an application that determines product shipping distance using the Google Maps API and displays relevante content in a certain DOM element when the Google Map is refreshed.

Check it out here: http://www.schwebdesign.com/zooktemp/map5.php
Use Firefox first.  It works fine doesn't it?  It does for me.  Firebug and the Web Developer Toolbar show NO javascript, css, or html errors of any kind.  
That's exactly what it's supposed to do.

Using Internet Explorer 7:
The javascript for modifying the DOM element's content still works when the links on the left are clicked.
But the Map itself, calculation of Shipping distance, and display of relevant content in the respective DOM element upon finding shipping distance does not work.  The map doesn't display.

The error i recieve is this:

Line: 4 Char: 9 Error: Object doesn't support this property or method. Code: 0

I'm assuming it's referring to http://www.schwebdesign.com/zooktemp/js/gmaps.js 
Line 4 of gmaps.js contains only this:
            map.enableGoogleBar();


Removing that line does not effect the line of the error or solve the problem.

please check out the source at: http://www.schwebdesign.com/zooktemp/map5.php
linked JS scripts are at: http://www.schwebdesign.com/zooktemp/js/gmaps.js and http://www.schwebdesign.com/zooktemp/js/js.js

Why does this work flawlessly in Firefox yet die in IE?  The code is perfect as far as i can tell.  

Does anyone have any insight in to this?

Please, any advice is greatly greatly appreciated.
0
Comment
Question by:LeftHandedPants
  • 4
  • 4
9 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22794200
try the following

1. swap

<script type="text/javascript" src="js/js.js"></script>
<script type="text/javascript" src="js/gmaps.js"></script>

2. add DEFER to the scripts

<script type="text/javascript" DEFER src="js/gmaps.js"></script>
<script type="text/javascript" DEFER src="js/js.js"></script>

0
 

Author Comment

by:LeftHandedPants
ID: 22796929
Thank You Very Much for your suggestion.

I tried what you said and if you check the source you can see that it reflects

<script type="text/javascript" DEFER src="js/gmaps.js"></script>
<script type="text/javascript" DEFER src="js/js.js"></script>

I also tried:
<script type="text/javascript" defer="defer" src="js/gmaps.js"></script>
<script type="text/javascript" defer="defer" src="js/js.js"></script>

but... the problem persists only in Internet Explorer
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22798090
Then I do not know.

Perhaps try to register the onload using a framework
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:LeftHandedPants
ID: 22798349
I'm pretty new to Javascript / AJAX / the Google MAPS API

Could you please give me a few pointers on what you mean by "Perhaps try to register the onload using a framework" ...perhaps a tutorial, or something to read up on with respect to your recommendation.

Thanks,

Does anyone else have any advice or thingsi could try?

0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22801868
I meant this
http://15daysofjquery.com/quicker/4/
but I am no longer so sure that is a better idea. Sorry
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22801870
How about merging the two js files so you know all is loaded at the same time?
0
 

Author Comment

by:LeftHandedPants
ID: 22813692
"How about merging the two js files so you know all is loaded at the same time?"

Nope, sorry, that does not fix the problem.  Problem remains the same.  

Any other ideas?

Is there anyone else reading this thread?

It works perfectly in Firefox with no errors, but not Internet Explorer.  Hmmmm...
0
 

Accepted Solution

by:
LeftHandedPants earned 0 total points
ID: 22818135
okay i have figured it out.   turned out I had a clash of variable names.
 
 I fixed it by renaming the map div DOM element from map to something else.
it works great in Firefox and IE now.

Thanks for all the help i did receive here.  
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question