问题描述
我的页面正在返回SCRIPT16389:IE8中的未指定错误。我认为我找到了它的原因,但没有解决方案。
My page is returning SCRIPT16389: Unspecified error in IE8. I think I have found the reason for it but no solution.
该错误来自Google Maps API,函数mq(a,b)。问题是IE8似乎无法处理异步加载的内容上的getBoundingClientRect(),并且使用jQuery.load()加载内容。如果我用页面创建页面时加载页面的内容不是异步的,那么就不会发生错误。
The error is coming from Google Maps API, function mq(a,b). The problem is that IE8 does not appear to be able to handle getBoundingClientRect() on asynchronously loaded content, and I'm loading content using jQuery.load(). The error doesn't occur if I create a page with the same content loading with the page rather than asynchronously.
这个错误发生在页面加载,然后任何时候窗口无论是否显示地图,都会调整大小。
The error occurs on page load and then any time the window is resized, no matter whether a map is displayed or not.
我发现人们在几年前对jQuery有同样的问题:
I discovered that people were having the same problem with jQuery a few years ago:http://bugs.jquery.com/ticket/4996Is there a workaround for IE 6/7 "Unspecified Error" bug when accessing offsetParent
有人知道修补程序或解决方法吗?或者我做错了什么?
Does anybody know of a fix or workaround? Or am I doing something wrong?
非常感谢。
Thanks very much.
推荐答案
我明白了。我发布了我的答案,以防其他人遇到同样的问题。
I figured it out. I am posting my answer in case someone else has the same problem.
为了重现错误,我必须首先加载一个带有地址自动完成输入的页面。然后,我会加载其他内容,替换该字段。当窗口大小调整事件无法找到不存在的输入的维度时,错误发生。
To reproduce the error, I had to first load a page with a Places Autocomplete input. Then, I would load other content, replacing the field. The error was happening when the window resize event could not find the dimensions of the nonexistent input.
我通过调用
$ b解决了这个问题$ b
I solved the problem by calling
google.maps.event.clearListeners(window, 'resize');
加载新内容之前。
我希望这能帮助别人。
这篇关于来自IE8上Google Maps API的未指定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!