Refreshing Google Maps API V3 Layers

前端 未结 8 1807
温柔的废话
温柔的废话 2020-12-09 03:12

I\'ve been having trouble getting Google Maps API v3 to update correctly. I\'ve got a javascript timer running that should be refreshing the traffic layer periodic

8条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-09 03:31

    Sergio's answer is still the correct one but I believe Google updated their API and URLs (a risk mentioned by a commenter).

    The correct test would be now:

    ....
    if (/googleapis.com\/maps\/vt\?pb=/.test(src)) {
    ...
    

提交回复
热议问题