神秘的'对象不支持google.load上的IE8这种方法'的错误 [英] Mysterious 'object doesnt support this method'error in IE8 on google.load

查看:204
本文介绍了神秘的'对象不支持google.load上的IE8这种方法'的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地搜索应用中使用Google搜索JSAPI。一切工作正常,除了IE 8以外的所有浏览器。问题是特定的代码行后,我的jQuery基础对象和谷歌对象drreferenced。



它是一个直接的代码。我能够使用来重现问题。



html代码是

 < html> 
< head>
< title>测试地图< /标题>
< script src =http://www.google.com/jsapi?类型= 文本/ JavaScript的 >< /脚本>

< / head>
< body>
< div id =map_canvas>< / div>
< / body>
< / html>

和JS

 < ($); 
alert(1);
google.load('search',1);
alert($);

google.setOnLoadCallback(function(){
alert(2);
});
});

在行 google.load('search',1) code>我得到以下错误:
$ b $ p

错误:对象不支持此属性或方法



关于 $ google



这完全是一场噩梦。我没有运气好几个小时与这个战斗。任何IE专家在这里都有一个想法吗?

解决方案

改变你的jsFiddle为No wrap ...

$ $ $ $ $(function(){
// alert(1);
google.load('search',1);
alert($);

google.setOnLoadCallback(function(){
alert(2);
} );
//});

几乎相同的问题在这里提出: Google没有使用Google Visualization API定义Google;可能jQuery的错误


i am using google search JSAPI in my local search app. Everything works fine in all the browsers except IE 8. The problem is after the specific line of code my jquery base object and google objects are drreferenced.

Its a straight forward code. I am able to reproduce the problm using this jsfiddle.

html code is

<html>
    <head>
        <title>Test Map</title>
        <script src="http://www.google.com/jsapi?" type="text/javascript"></script>

    </head>
    <body>
        <div id="map_canvas"></div>
    </body>
</html>

and JS

$(function() {
    alert(1);
    google.load('search',1);
    alert($);

    google.setOnLoadCallback(function() {       
        alert(2);
    });
});

after the line google.load('search',1) i got the following error

Error: Object doesn't support this property or method

on $ and google.

This is totally a nightmare. I am fighting with this for hours without a luck. Any IE experts here got an idea?

解决方案

Change your jsFiddle to "No wrap (body)" and modify your function like so...

//$(function() {
    //alert(1);
    google.load('search',1);
    alert($);

    google.setOnLoadCallback(function() {       
        alert(2);
    });
//});

Nearly the same question asked here: Google is not defined using Google Visualization API; possibly jQuery's fault

这篇关于神秘的'对象不支持google.load上的IE8这种方法'的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆