简体   繁体   English

Google Maps 2.0 API问题

[英]Google Maps 2.0 API Issues

The Google Maps API was updated on 2/17 and has caused some issues for me. Google Maps API已于2/17更新,对我造成了一些问题。 I help maintain several legacy application that aren't being actively developed, but are still being used. 我帮助维护了一些遗留应用程序,这些应用程序并未得到积极开发,但仍在使用中。 After the update a bunch of them stopped working properly. 更新后,其中一些停止正常工作。 The main problem was a pretty easy fix. 主要问题是一个非常容易解决的问题。 Most of them did not specify a specific version so they were using the experimental branch. 他们中的大多数没有指定特定版本,因此他们使用的是实验分支。 I was able to target 3.19 and they started working again. 我能够达到3.19的目标,他们又开始工作了。

My bigger problem is with an application that is still using API version 2.0. 我更大的问题是仍在使用API​​版本2.0的应用程序。 I know it is recommended to upgrade to version 3.0, but like I said, this application is just being maintained. 我知道建议升级到3.0版,但是就像我说的那样,此应用程序正在维护中。 It was working so there was no reason to spend the time to update it. 它正在运行,因此没有理由花费时间对其进行更新。 After the latest update it has stopped working. 最新更新后,它已停止工作。

I know that when they pulled the plug on API 2.0 they left a wrapper around 3.0 for legacy use. 我知道,当他们拔掉API 2.0的插头时,他们留下了3.0左右的包装,以用于旧版。 Does anyone know if this has been changed with the latest update? 有人知道最新的更新是否已更改? Is it possible to target the version of API 3 that the wrapper uses? 是否有可能针对包装器使用的API 3版本? Has anyone else seen similar issues with the update? 其他人是否看到过与此更新类似的问题?

Here is the code that is failing 这是失败的代码

    function loadMap() {

    try 
    {

        mmap = new GMap2(document.getElementById("map"), { draggableCursor: 'crosshair', draggingCursor: 'move' });
        geocoder = new GClientGeocoder();

    }
    catch (Error) {
        mmap = null;

        return "NG";
    }

    mmap.setCenter(new GLatLng(0, 0), 2);
    mmap.addControl(new GLargeMapControl());
    mmap.addControl(new GMapTypeControl());
    mmap.enableScrollWheelZoom();
    mmap.enableDoubleClickZoom();
    mmap.enableContinuousZoom();

    return "OK";

I am calling this from a .NET application and it is returning null. 我从.NET应用程序调用此函数,并且它返回null。

 Object something = wb.Document.InvokeScript("loadMap");

It probably just needs to be updated to v3, but I don't know why it has worked all this time and then suddenly stopped. 它可能只需要更新到v3,但我不知道为什么一直都在工作,然后突然停止。

I finally found a solution after doing some more digging. 经过更多的挖掘,我终于找到了解决方案。 It seems to be a combination of a bug and the WebBrowser control. 它似乎是一个错误和WebBrowser控件的组合。 With the latest version the API breaks in IE compatibility mode. 使用最新版本的API会在IE兼容模式下中断。 Google has confirmed this bug and are working on a fix. Google已确认此错误,正在努力解决。 Evidently the WebBrowser control must run in compatibility mode and causes the bug. 显然,WebBrowser控件必须在兼容模式下运行并导致该错误。

I was able to fix it by adding 我能够通过添加来修复它

<!DOCTYPE html>

at the top of the page and 在页面顶部,

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />

inside the head tag. 在头部标签内。

https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675 https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM