Welcome Guest, Not a member yet? Register   Sign In
Problems with Google Maps in IE
#1

[eluser]swanky[/eluser]
I'm having problems displaying a Google Map in IE. I'm using Firefox on a Mac. Everything looks fine, and Firebug isn't giving me any errors. But... But... My clients (Windows Vista, IE 7) are getting a gray box where the map should be!!!

Actually none of my Javascript seems to work on their computer, which makes me think that their virus protection software is causing the problem. I've worked around it everywhere else on the site, so everyone (my clients) can have a good experience (working JS or not) and I'm tried a few different solutions to my map problem, but I'm not sure I have it fixed.

Would those of you out there working on Windows please take a look and tell me if my maps are working for them?
Map 1 (no info window)
Map 2 (info window)

Here is my map code. The maps are both in their own files which are inserted into the head of my template via the parser.
Code:
//<![CDATA[
    function load() {
        if (GBrowserIsCompatible()) {
            
            function addMap(response) {
                map.clearOverlays();
                if (!response || response.Status.code != 200) {
                    alert("Sorry, we were unable to geocode that address");
                } else {
                    
                    place = response.Placemark[0];
                    point = new GLatLng( place.Point.coordinates[1],
                                         place.Point.coordinates[0]);
                    center = new GLatLng(place.Point.coordinates[1]+.007,
                                            place.Point.coordinates[0]+.008);            
                    marker = new GMarker(point);
                    
                    map.setCenter(center, 13);
                    map.addControl(new GSmallMapControl());
                    map.addOverlay(marker);
                    
                }
            }
            
            address = "<?php echo $details->address.', '.$details->zip; ?>";
            map = new GMap2(document.getElementById("map"));
            geocoder = new GClientGeocoder();
            geocoder.getLocations(address, addMap)            
        }    
    }          
    //]]>

Code:
<?php
// Map 2
$html  = '<div style="width: 210px; padding-right: 10px"><strong>';
$html .= $details->member;
$html .= '<\/strong><br\/>';
if ($details->address!=NULL) $html .= $details->address.' ';
$html .= '<br\/>';
if ($details->city!=NULL)    $html .= $details->city.', ';
if ($details->state!=NULL)   $html .= $details->state.', ';
if ($details->zip!=NULL)     $html .= $details->zip;
$html .= '<br\/>';
if ($details->phone!=NULL) $html .= $details->phone;
$html .= '<\/div>';

?&gt;
    
    
    //&lt;![CDATA[
    function load() {
        if (GBrowserIsCompatible()) {
            
            function addMap(response) {
                map.clearOverlays();
                if (!response || response.Status.code != 200) {
                    alert("Sorry, we were unable to geocode that address");
                } else {
                    html = '&lt;?php echo $html; ?&gt;';
                    place = response.Placemark[0];
                    point = new GLatLng( place.Point.coordinates[1],
                                         place.Point.coordinates[0]);
                    center = new GLatLng(place.Point.coordinates[1]+.007,
                                            place.Point.coordinates[0]+.008);            
                    marker = new GMarker(point);
                    
                    map.setCenter(center, 13);
                    map.addControl(new GSmallMapControl());
                    map.addOverlay(marker);
                    marker.openInfoWindowHtml(html);
                }
            }
            
            address = "&lt;?php echo $details->address.', '.$details->zip; ?&gt;";
            map = new GMap2(document.getElementById("map"));
            geocoder = new GClientGeocoder();
            geocoder.getLocations(address, addMap)            
        }    
    }          
    //]]>

Thank you.

Edit: The forum seems to have stripped out my script tags.... The actual code is wrapped in them.
#2

[eluser]Crazy88s[/eluser]
Running Windows Vista and IE and have the same problem as what your users are reporting. It runs just fine in Firefox on the same box.

IE says:

Line: 35
Char: 4
Error: Object doesn't support this property or method
Code: 0
URL: http://tniada.swankautosites.com/auction...s/12/37138
#3

[eluser]swanky[/eluser]
Thanks. The error msg was helpful. That's the address variable line.
Code:
address = "&lt;?php echo $details->address.', '.$details->zip; ?&gt;";
It's the results of my db query that I'm trying to feed the JS. I'm NOT a JS expert. Does anyone know why would IE have a problem with this?

Just in case, I changed it to this.
Code:
address = &lt;?php echo $address; ?&gt;;
Getting rid of the quotes (put them directly in the echo), and the comma. Would you mind taking a second look and telling me if its fixed anything?
Map 1

Here's the new code in full with modified s_c_r_i_p_t tags that hopefully won't get stripped out...
Code:
&lt;?php $address = '"'. $details->address.' '.$details->zip.'"'; ?&gt;
    <s_c_r_i_p_t src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAV4nVWv2jMj7fZGiz8Uu0GRTEhQrAF-arFFoGvlx59xUyQ10wfRRV-edRsIyA6qIWY7vvplYPlq7YsA" type="text/javascript">
    </s_c_r_i_p_t>
    <s_c_r_i_p_t type="text/javascript">
    //&lt;![CDATA[
    function load() {
        if (GBrowserIsCompatible()) {
            
            function addMap(response) {
                map.clearOverlays();
                if (!response || response.Status.code != 200) {
                    alert("Sorry, we were unable to geocode that address");
                } else {
                    
                    place = response.Placemark[0];
                    point = new GLatLng( place.Point.coordinates[1],
                                         place.Point.coordinates[0]);
                    center = new GLatLng(place.Point.coordinates[1]+.007,
                                            place.Point.coordinates[0]+.008);            
                    marker = new GMarker(point);
                    
                    map.setCenter(center, 13);
                    map.addControl(new GSmallMapControl());
                    map.addOverlay(marker);
                    
                }
            }
            
            address = &lt;?php echo $address; ?&gt;;
            map = new GMap2(document.getElementById("map"));
            geocoder = new GClientGeocoder();
            geocoder.getLocations(address, addMap)            
        }    
    }          
    //]]>
    </s_c_r_i_p_t>
Thanks Again.
#4

[eluser]swanky[/eluser]
I'm not sure how to mark a thread solved, but I've figured out my problem. I wasn't defining my JS variables properly. For those of you who want to know, here's the link, and here's the finished code.
Code:
&lt;?php
$address= '\''.$details->address.' '.$details->zip.'\'';
$html  = '\'<div style="width: 210px; padding-right: 10px"><strong>';
$html .= $details->auction;
$html .= '<\/strong><br\/>';
if ($details->address!=NULL) $html .= $details->address.' ';
$html .= '<br\/>';
if ($details->city!=NULL)    $html .= $details->city.', ';
if ($details->state!=NULL)   $html .= $details->state.' ';
if ($details->zip!=NULL)     $html .= $details->zip;
$html .= '<br\/>';
if ($details->phone_1!=NULL) $html .= $details->phone_1;
if ($details->phone_2!=NULL) $html .= ' or '.$details->phone_2;
if ($details->website!=NULL) $html .= '<br\/><a href="'.$details->website.'">'.$details->website.'<\/a>';
$html .= '<\/div>\'';

?&gt;
<s-c-r-i-p-t src="http://maps.google.com/maps?file=api&amp;v=2.x&amp;key=ABQIAAAAV4nVWv2jMj7fZGiz8Uu0GRTEhQrAF-arFFoGvlx59xUyQ10wfRRV-edRsIyA6qIWY7vvplYPlq7YsA" type="text/javascript">
</s-c-r-i-p-t>
<s-c-r-i-p-t type="text/javascript">
    //&lt;![CDATA[
    function load() {
        if (GBrowserIsCompatible()) {
            var address = &lt;?php echo $address; ?&gt;;
            var map;
            var geocoder = null;

            function addMap(response) {
                map.clearOverlays();
                if (!response || response.Status.code != 200) {
                    alert("Sorry, we were unable to geocode that address");
                } else {
                    var html = &lt;?php echo $html; ?&gt;;
                    var place = response.Placemark[0];
                    var point = new GLatLng( place.Point.coordinates[1],
                                         place.Point.coordinates[0]);
                    var center = new GLatLng(place.Point.coordinates[1]+.007,
                                            place.Point.coordinates[0]+.008);            
                    var marker = new GMarker(point);
                    
                    map.setCenter(center, 13);
                    map.addControl(new GSmallMapControl());
                    map.addOverlay(marker);
                    marker.openInfoWindowHtml(html);
                }
            }
            map = new GMap2(document.getElementById("map"));
            geocoder = new GClientGeocoder();
            geocoder.getLocations(address, addMap);
        }    
    }          
    //]]>
</s-c-r-i-p-t>
#5

[eluser]John_Betong[/eluser]
&nbsp;
I just tested your site with IE6 and it did not work.
&nbsp;
So I tested My Hippy Trail and that did not work but it did come up with a message saying that Javascript was disabled.

I tried to enable Javascript in IE6 but it was not intuitive so a quick Google brought up how to enable Javascript on IE6

Now both your site and My Hippy Trail can be seen OK.
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB