getScript停止工作 [英] getScript stopped working

查看:139
本文介绍了getScript停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了加快我们网站的加载时间,我们推迟了某些脚本的加载.直到几天前,它一直运行良好.我将问题归结为HTML的这个简短页面.

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>

似乎该脚本具有text/plain内容类型.我不确定周末之前是什么时候.这可能是问题吗?

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?

在Fiddler中,似乎从未提出过请求,但是当我将URL粘贴到另一个选项卡中时,可以提取该请求.如果在我的控制下将scriptUrl更改为1,它将正常工作.发生了什么事?

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?

推荐答案

检查您的插件/扩展名等,确保广告脚本本身未被其他过滤器(广告拦截器扩展,代理过滤器等)拦截).

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

它对我有用,您可以在这里进行测试-我在没有广告拦截器的chrome中进行测试.

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

这篇关于getScript停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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