3

由于某种奇怪的原因,我遇到了 Chromium 未加载 jQuery 插件的问题。

如果我通过子域访问该页面,它将不会加载。如果我通过根域访问该页面,一切正常。另外,如果我使用 Firefox,两种方式都可以。

这是我正在尝试的简单版本:

<html>
<head>
  <title>Digital Eagle.net Examples</title>
  <script src='js/jquery-1.6.4.js'></script>
  <script src='js/jquery.jLog.js'></script>

  <script>
     $(document).ready(function() {
        $.log('Testing');
        alert('Test worked successfully');

         $('button').click(function() {
            $.log('Testing Button');
            alert('Button Test worked successfully');
         });
    });

  </script>
</head>
<body>

<button>Test Log Plugin</button>

</body>
</html>

当我通过http://digitaleagle.net/example/subdomain.php访问此页面时,一切正常。我看到了警报对话框。

当我使用子域访问页面时,它突然停止工作!链接http://example.digitaleagle.net/subdomain.php返回一个 javascript 错误:

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no method 'log' (anonymous function)

在这个例子中,我在使用日志插件时遇到了问题。在我的实际应用程序中,我也遇到了 Google Analytics 插件的问题。

这是铬错误吗?

这是我的 Chromium 版本信息:

14.0.835.186 (Developer Build 0) Built from source for Fedora release 15 (Lovelock)

我会继续研究,但是有人对我做错了什么有任何想法吗?

更新:我尝试安装 Chrome 的稳定版和开发版,但我遇到了同样的问题。当我第一次打开 Chrome 时,我看到了 alert() 对话框,但在那之后,它会产生 javascript 错误。我想知道这是否是与 Fedora 15 相关的问题?

这是我当前的版本信息:

Google Chrome   16.0.904.0 (Official Build 104662) dev
OS  Linux
WebKit  535.7 (@96998)
JavaScript  V8 3.6.4.1
Flash   (Disabled)
User Agent  Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.904.0 Safari/535.7
Command Line     /usr/bin/google-chrome --block-reading-third-party-cookies --flag-switches-begin --enable-print-preview --flag-switches-end
Executable Path /opt/google/chrome/google-chrome
Profile Path    /home/skp/.config/google-chrome/Default

更新——

这是我的 TamperMonkey 扩展!我重命名了我的配置文件目录( $HOME/.config/chromium/ ),并且它起作用了。然后,为了试验,我一一禁用了我的扩展。一旦我禁用 TamperMonkey,它就可以正常工作!

所以,现在的问题是,我如何同时获得两者?我将 TamperMonkey 用于其他事情。也许我可以在那个项目上打开一个错误。

4

1 回答 1

1

I posted this over on TamperMonkey's website, and Jan fixed the bug for me. You can view the thread here:

tampermonkey.net: subdomain + jQuery issue

To fix the issue, download the Beta version from the Chrome Store. (version 2.2.2521)

于 2011-11-16T04:30:47.900 回答