1

To speed up the load time of our site, we defer the loading of some scripts. This has been working fine until a couple of days ago. I've boiled the issue down to this short page of HTML.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <script type="text/javascript" 
            src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js">
        </script>
        <script type="text/javascript">
            //<![CDATA[
                var scriptUrl = "http://ads.trafficspaces.net/v1.22/adservice.js";
                jQuery
                    .getScript(
                        scriptUrl, 
                        function () {
                            alert("I'm never called")
                        });
            //]]>
        </script>
    </head>
    <body>
    </body>
</html>

It would appear that the script in question is served with a text/plain content type. I'm not sure what it was before the weekend. Could this be the problem?

Looking in Fiddler, it appears the request is never made, but I can fetch it when I paste the URL into another tab. If I change scriptUrl to one under my control, it works fine. What's going on?

5
  • 3
    Works for me :) jsbin.com/olevi4 Commented Dec 6, 2010 at 20:40
  • 2
    Lightbulb moment. AdBlockPro. Grrr. Commented Dec 6, 2010 at 20:41
  • Thanks @Nick. Your confirmation that it worked instantly brought me to the right conclusion. I switched on ABP because I was working remotely and animated adverts over RDP make it unusable. Silly me. The upside is that it's brought a not too uncommon case that needs dealing with in a more robust way. Thanks again. Commented Dec 6, 2010 at 20:48
  • added a few things to check in an answer below...I guarantee someone finds this later and has the same eureka moment :) Commented Dec 6, 2010 at 20:52
  • Yep. I deleted the question, then undeleted because it's been a painful hour of feeling stupid. If this helps the next person who cleverly tries to develop advert functionality while using an ad blocker then I thought it should remain! Commented Dec 6, 2010 at 20:59

1 Answer 1

3

Check your addons/extensions and such, make sure that the ad script itself isn't being blocked by some other filter(ad blocker extension, proxy filter, etc).

It works for me, you can test it here - I'm testing in chrome with no ad blocker.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.