“谷歌未定义"在 Firefox 中远程使用 Google Maps V3 时 [英] "google is not defined" when using Google Maps V3 in Firefox remotely

查看:24
本文介绍了“谷歌未定义"在 Firefox 中远程使用 Google Maps V3 时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的难题:我有一个使用 Google Maps V3 和 jQuery 的页面.这一切在 FF5、Chrome 和 Safari 中都运行良好.

Here's my conundrum: I have a page that uses Google Maps V3 and jQuery. It all worked well locally in FF5, Chrome and Safari.

上传到网站后,我在尝试使用 google 对象的第一行收到未定义 google"错误

Once I uploaded to a web site, I get a "google is not defined" error on the first line that I try to use a google object

var defaultLocation = new google.maps.LatLng(lat, lng);

仅发生在 FF 中,并且仅远程发生(即,如果我将文件加载到本地的 FF 中,它运行良好).无论如何,Chrome 和 Safari 似乎都运行良好,我的 Android 和 iPod 浏览器也是如此.

It only occurs in FF and only occurs remotely (i.e., if I load the file into FF locally, it works well). Chrome and Safari seem to be working great regardless, as is my Android and iPod browsers.

这是我目前尝试过的:

  1. 移动了 <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 部分的顶部.
  2. $(function() {...}); 的所有内容移动到名为 initialize() 的函数中,并添加了 <body onload=初始化()">
  3. 使用脚本和 css 文件顺序
  4. 粘贴网址 http://maps.google.com/maps/api/js?sensor=false 进入 FF 地址框并验证我正在获取合法的脚本
  1. Moved <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> to top of the <head> section.
  2. Moved all content of $(function() {...}); to a function called initialize() and added <body onload="initialize()">
  3. Played with scripts and css files order
  4. Pasted the URL http://maps.google.com/maps/api/js?sensor=false into FF address box and verified I'm getting the legit script

但由于这仅在远程机器上的 FF 中发生并且在其他情况下运行良好,我认为这与我的代码没有任何关系.也许FF5中的加载顺序被搞砸了.也许它对网络资源的优先级与其他浏览器不同.我现在真的不知道该怎么办.

But since this is only happening in FF on a remote machine and works well otherwise, I don't think it has anything to do with my code. Maybe the load order in FF5 is screwed. Maybe it prioritizes network resources differently than other browsers. I really do not know what to make of it at this point.

感谢任何帮助.
家伙

Any help is appreciated.
Guy

更新:
只是想补充以下事实:在 Mac 上尝试了前一个之后,我在 Windows 中尝试了 FF5,并复制了完全相同的行为.
为了更好的衡量,我也尝试了 Pale Moon - 结果相同.Chrome 14、Opera 11.50 甚至该死的 IE9(未包含在测试计划中)都可以工作.它只是 FF5,现在在 Mac 和 Windows 7 上都在该页面上失败.

Update:
Just wanted to add the following fact: After trying the previous on a Mac, I tried FF5 in Windows, and have replicated the exact same behavior.
For good measure, I tried Pale Moon as well - same results. Chrome 14, Opera 11.50 and even frickin' IE9 (which wasn't included in the test plan) work. It just FF5, now on both Mac and Windows 7, that fails on that page.

推荐答案

我多次遇到谷歌未定义".可能 Google Script 有一些问题,FF-addon 不能很好地加载顺便提一句.FF 有重启选项(比如窗口重启)帮助 > 禁用附加组件重新启动

I faced 'google is not defined' several time. Probably Google Script has some problem not to be loaded well with FF-addon BTW. FF has restart option ( like window reboot ) Help > restart with Add-ons Disabled

这篇关于“谷歌未定义"在 Firefox 中远程使用 Google Maps V3 时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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