google.load 上 IE8 中的神秘“对象不支持此方法"错误 [英] Mysterious 'object doesnt support this method'error in IE8 on google.load
问题描述
我在本地搜索应用中使用谷歌搜索 JSAPI.在除 IE 8 之外的所有浏览器中一切正常.问题是在特定代码行之后,我的 jquery 基础对象和 google 对象被 drreferenced.
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.
这是一个直接的代码.我可以使用 this jsfiddle 重现问题.
Its a straight forward code. I am able to reproduce the problm using this jsfiddle.
html 代码是
<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>
和JS
$(function() {
alert(1);
google.load('search',1);
alert($);
google.setOnLoadCallback(function() {
alert(2);
});
});
在 google.load('search',1)
行之后,我收到以下错误
after the line google.load('search',1)
i got the following error
错误:对象不支持此属性或方法
在 $
和 google
上.
这完全是一场噩梦.我在没有运气的情况下为此奋斗了几个小时.这里有 IE 专家有想法吗?
This is totally a nightmare. I am fighting with this for hours without a luck. Any IE experts here got an idea?
推荐答案
将您的 jsFiddle 更改为No wrap (body)"并像这样修改您的函数...
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);
});
//});
这里问的问题几乎相同:Google 未使用 Google Visualization API 定义;可能是 jQuery 的错
Nearly the same question asked here: Google is not defined using Google Visualization API; possibly jQuery's fault
这篇关于google.load 上 IE8 中的神秘“对象不支持此方法"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!