Javascript 我的谷歌地图测距仪无法正确使用SSL

Javascript 我的谷歌地图测距仪无法正确使用SSL,javascript,google-maps,Javascript,Google Maps,我似乎无法让它在SSL中正常工作,而不在IE中抛出一个关于SSL安全性的错误。请帮助我,因为我不太擅长Javascript <script src="//maps.google.com/maps?file=api&v=2&key=MY_API" type="text/javascript"></script> <script type="text/javascript"> var geocoder, location1, l

我似乎无法让它在SSL中正常工作,而不在IE中抛出一个关于SSL安全性的错误。请帮助我,因为我不太擅长Javascript

<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>

var地理编码器,位置1,位置2,gDir;
函数初始化(){
geocoder=新的GClientGeocoder();
gDir=新的GDirections();
addListener(gDir,“加载”,函数(){
var drivingDistanceMiles=gDir.getDistance().meters/1609.344;
var drivingDistanceKM=gDir.getDistance().meters/1000;
var shippingPrice=行驶距离英里*1.50;
document.getElementById('results').innerHTML='工厂地址:'+location1.Address++

您的地址:'+location2.Address++

行驶距离:+drivingDistanceMiles.toFixed(1)+/p>=“颜色:红色;“>预计运输成本:$”+运输价格。toFixed(2)+“美元”; }); } 函数showLocation(){ geocoder.getLocations(document.forms[0].address1.value,函数(响应){ 如果(!response | | response.Status.code!=200) { 警报(“抱歉,我们无法对第一个地址进行地理编码”); } 其他的 { location1={lat:response.Placemark[0]。点。坐标[1],lon:response.Placemark[0]。点。坐标[0],地址:response.Placemark[0]。地址}; geocoder.getLocations(document.forms[0].address2.value,函数(响应){ 如果(!response | | response.Status.code!=200) { 警报(“抱歉,我们无法对第二个地址进行地理编码”); } 其他的 { location2={lat:response.Placemark[0]。点。坐标[1],lon:response.Placemark[0]。点。坐标[0],地址:response.Placemark[0]。地址}; gDir.load('from:'+location1.address+'到:'+location2.address'); } }); } }); } 估计你的运费

输入您的地址:


我猜它正在使用api的第2版,但我不知道如何更改它。

更改为
只有Premier成员才能通过SSL访问api的第2版

第三版还可以

来源:(SSL部分的最后一部分有您的确切错误)