[英]Uncaught ReferenceError: GBrowserIsCompatible is not defined
Am getting error:Uncaught ReferenceError: GBrowserIsCompatible is not defined. 正在获取错误:未捕获ReferenceError:未定义GBrowserIsCompatible。 i have function in js file which am loading on document .ready() event.
我在正在加载文档.ready()事件的js文件中具有功能。
if (GBrowserIsCompatible()) {
//do somthing
}
am loading js file using: 我正在使用以下方式加载js文件:
$(document).ready(function() {
$.getScript("test.js", function(){
alert("Script loaded and executed.");
});
Thanks in advance :) 提前致谢 :)
There are couple of possible reasons for this 有几个可能的原因
1. Can you verify you have load the Google Maps API with your validated API key . 1.您可以验证是否已使用经过验证的API密钥加载Google Maps API。 Check this for same.
检查是否相同。
<script src='http://maps.google.com/maps?file=api&v=2&key=My_API_KEY'></script>
2. Also what is possible is you are checking for it early . 2.还有可能是您要提早检查 。 Try something like
尝试类似
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.');
}
}
}
GBrowserIsCompatible()
is deprecated and since v3 has been removed from API. 不建议使用
GBrowserIsCompatible()
,因为v3已从API中删除。 There's no need to use this check in v3. 在v3中无需使用此检查。
From guide for upgrading from v2 to v3 : 从从v2升级到v3的指南 :
The
GBrowserIsCompatible()
andGUnload()
methods are no longer required in v3, and have been removed from the APIGBrowserIsCompatible()
中不再需要GBrowserIsCompatible()
和GUnload()
方法,它们已从API中删除
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.