开发者

jQuery Plugin won't work on Subdomain

开发者 https://www.devze.com 2023-04-12 12:33 出处:网络
I have an issue with Chromium not loading a jQuery plugin for some strange reason. If I hit the page through a subdomain, it will not load.If I hit the page through the root domain, everything works

I have an issue with Chromium not loading a jQuery plugin for some strange reason.

If I hit the page through a subdomain, it will not load. If I hit the page through the root domain, everything works fine. Also, if I use Firefox, both ways work.

Here's a simple version of what I am trying:

<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>

When I hit this page through, http://digitaleagle.net/example/subdomain.php, everything works fine. I see the alert dialogs.

When I use the subdomain to access the page, it suddenly quits working! The link, http://example.digitaleagle.net/subdomain.php, returns a javascript error:

Uncaught TypeError: Object function (a,b){return new e.fn.init(a,b,h)} has no meth开发者_开发技巧od 'log' (anonymous function)

In this example, I am having trouble with the log plugin. In my actual application, I am also having trouble with a Google Analytics plugin.

Is this a Chromium bug?

Here's my Chromium version info:

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

I'll keep researching, but does anyone have any thoughts as to what I am doing wrong?

Update: I have tried installing both the stable and the Dev build of Chrome, and I have the same issue. When I first open Chrome, I see the alert() dialog, but after that, it produces the javascript error. I wonder know if it is a Fedora 15-related problem?

Here's my current version info:

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

Update --

It was my TamperMonkey extension! I renamed my profile directory ( $HOME/.config/chromium/ ), and it worked. Then, just to experiment, I disabled my extensions one by one. As soon as I disabled TamperMonkey, it worked fine!

So, now the question is, how do I get both? I use TamperMonkey for other things. Maybe I can open a bug on that project.


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号