简体   繁体   English

为什么我的 jquery 在不同的域上不起作用?

[英]Why my jquery doesn't work on different domain?

I have same code on 2 different websites, 1 is working fine and other one looks like it is not doing jquery functions我在 2 个不同的网站上有相同的代码,1 个工作正常,另一个看起来没有执行 jquery 功能

<!DOCTYPE html> 
<html>
  <head>
     <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> 
     <title>jQuery Countdown</title> 
     <link rel="stylesheet" href=/build/timer/css/jquery.countdown.css">
     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>      
     <script src="/build/timer/js/jquery.plugin.min.js"></script>
     <script src="/build/timer/js/jquery.countdown.js"></script> 
     <script> 
       var j = jQuery.noConflict(); 
       j(function () {  
         var austDay = new Date();  
         austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);  
         j('#defaultCountdown').countdown({until: austDay});    
         j('#year').text(austDay.getFullYear()); }); 
     </script> 
     <style>
       #defaultCountdown {margin-left: -380px;width: 740px;height: 65px;}
       #defaultCountdown span {font-size: 30px;font-family: Arial;} 
        body {background: #0f0017;} 
     </style> 
   </head> 
<body>

  <div id="defaultCountdown"></div>

</body>
</html>

here is my code..这是我的代码..

here is a working link: http://signalsindicator.com/timer/index.html here is not working one: https://traders.institute/build/timer/index.html这是一个工作链接: http : //signalsindicator.com/timer/index.html这里没有工作: https : //traders.institute/build/timer/index.html

what may be causing this problem, it is same code on both of them?可能是什么导致了这个问题,它们都是相同的代码?

您发布的第二个链接是 https,因此您还必须使用 https 加载脚本。

What may be causing this problem, it is same code on both of them?可能是什么导致了这个问题,它们都是相同的代码?

The answer: Mixed content issue.答案是:混合内容问题。

A Mixed content occurs when initial HTML is loaded over a secure HTTPS connection, but other resources (such as images, videos, stylesheets, scripts) are loaded over an insecure HTTP connection.当初始 HTML 通过安全的 HTTPS 连接加载,但其他资源(例如图像、视频、样式表、脚本)通过不安全的 HTTP 连接加载时,会出现混合内容。

... More details here . ...更多细节在这里

Also missing the opening quotes around the stylesheet.还缺少样式表周围的开头引号。

href="/build/timer/css/jquery.countdown.css"> href="/build/timer/css/jquery.countdown.css">

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

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