2011-07-27 2 views
1

SSL 보안에 관한 IE에서 오류가 발생하지 않고 SSL에서 올바르게 작동하는 것으로 보입니다. Javascript로 그다지 좋지는 않지만 도움을주십시오.Google Maps Distance Finder가 SSL로 올바르게 작동하지 않음

<script src="//maps.google.com/maps?file=api&v=2&key=MY_API" type="text/javascript"></script> 

    <script type="text/javascript"> 

    var geocoder, location1, location2, gDir; 

    function initialize() { 
      geocoder = new GClientGeocoder(); 
      gDir = new GDirections(); 
      GEvent.addListener(gDir, "load", function() { 
        var drivingDistanceMiles = gDir.getDistance().meters/1609.344; 
        var drivingDistanceKilometers = gDir.getDistance().meters/1000; 
        var shippingPrice = drivingDistanceMiles * 1.50; 
        document.getElementById('results').innerHTML = '<p><strong style="color:red;">Factory Address: </strong>' + location1.address + ' </p><p><strong style="color:red;">Your Address: </strong>' + location2.address + '</p><p><strong style="color:red;">Driving Distance: </strong>' + drivingDistanceMiles.toFixed(1) + ' miles </p><p><strong style="color:red;">Estimated Shipping Cost:</strong> $' + shippingPrice.toFixed(2) + ' USD'; 
      }); 
    } 

    function showLocation() { 
      geocoder.getLocations(document.forms[0].address1.value, function (response) { 
        if (!response || response.Status.code != 200) 
        { 
          alert("Sorry, we were unable to geocode the first address"); 
        } 
        else 
        { 
          location1 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address}; 
          geocoder.getLocations(document.forms[0].address2.value, function (response) { 
            if (!response || response.Status.code != 200) 
            { 
              alert("Sorry, we were unable to geocode the second address"); 
            } 
            else 
            { 
              location2 = {lat: response.Placemark[0].Point.coordinates[1], lon: response.Placemark[0].Point.coordinates[0], address: response.Placemark[0].address}; 
              gDir.load('from: ' + location1.address + ' to: ' + location2.address); 
            } 
          }); 
        } 
      }); 
    } 

    </script> 

<body onload="initialize()"> 
<h3 style="color:red;">Estimate Your Shipping Cost</h3> 

    <form action="#" onsubmit="showLocation(); return false;"> 
      <p style="color:white;"> 
        <input type="text" name="address1" value="Douglas, GA" style="display:none" /> 
        Enter Your Address:<br/> 
        <input type="text" name="address2" placeHolder="Your Address" /> 
        <input type="submit" value="Search" /> 
      </p> 
    </form> 

    <p id="results" style="color:white;"></p> 

내 생각 엔 그것은 API의 버전 2를 사용하지만 방법이 변경하는 생각이 없다는 것입니다.

답변

0

변경 <script src="//maps.google.com/maps?file=api&v=2&key=MY_API" type="text/javascript"></script>에서 <script src="https//maps.google.com/maps?file=api&v=2&key=MY_API" type="text/javascript"></script>으로 변경하십시오.