2015-11-26 125 views
-1

出现错误:未捕获ReferenceError:未定义GBrowserIsCompatible。 我在js文件中加载了document.ready()事件。使用未捕获ReferenceError:未定义GBrowserIsCompatible

if (GBrowserIsCompatible()) { 
     //do somthing 
    } 

时加载的js文件:

$(document).ready(function() { 
     $.getScript("test.js", function(){ 
       alert("Script loaded and executed."); 
      }); 

感谢提前:)

+1

你是如何加载API的?您是否正在使用已弃用(并已关闭)的[Google Maps JavaScript API v2](http://stackoverflow.com/tags/google-maps-api-2/info)?请提供证明此问题的[最小,完整,测试和可读示例](http://stackoverflow.com/help/mcve)。 – geocodezip

回答

1

有几本
1.可能的原因,你可以验证你加载谷歌地图API与您验证的API密钥Check this

<script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=My_API_KEY'></script> 


2.还什么是可能是你检查它早。尝试类似

var iterations=0; 
    function checksIfscriptIsLoaaded() 
    { 
     if (typeof GBrowserIsCompatible === 'undefined') 
     { 
     setTimeout(ChecksIfscriptIsLoaaded, 1000); 
     iterations++;//you want to do this finite number of times say 10. 
     } 
     else 
     { 
     if (GBrowserIsCompatible()) { 
      //do your thing 
     } else { 
      alert('browser is not supported.'); 
     } 
     } 
    } 
相关问题