简体   繁体   English

jQuery无法在我的网站上工作,但可以在我的浏览器上工作吗?

[英]jQuery Not working on my site, but works on my browser?

Running into a problem on my site that I just tried hosting, for some reason, the jQuery code that I have written is working in my browser before I hosted it via HTTPS, but when I am trying to use it via the actual site, the jQuery is not responding. 由于某种原因,我刚尝试托管的站点上遇到一个问题,在我通过HTTPS托管它之前,我编写的jQuery代码在浏览器中运行,但是当我尝试通过实际站点使用它时, jQuery没有响应。 The image that is clicked is supposed to bring the document back to the top of the image when it is clicked. 单击的图像应该将文档带回到单击图像的顶部。 Here is the link to the site" https://www.andrewswanson94.byethost7.com/KiloArt/visions.html 这是指向该站点的链接” https://www.andrewswanson94.byethost7.com/KiloArt/visions.html

Console tells you the exact problem: 控制台会告诉您确切的问题:

Mixed Content: The page at ' https://www.andrewswanson94.byethost7.com/KiloArt/visions.html?ckattempt=1 ' was loaded over HTTPS, but requested an insecure script ' http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js '. 混合内容:通过HTTPS加载了位于https://www.andrewswanson94.byethost7.com/KiloArt/visions.html?ckattempt=1的页面,但请求了不安全的脚本http://ajax.googleapis.com/ ajax / libs / jquery / 1.3.2 / jquery.min.js '。 This request has been blocked; 该请求已被阻止; the content must be served over HTTPS. 内容必须通过HTTPS提供。

You can not mix http and https 您不能混合使用HTTP和https

Just replace <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> by <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> 只需将<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>替换为<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

The error is due to mixing HTTP and HTTPS 该错误是由于混合使用HTTP和HTTPS

Its best practive to use // instead of http ot https so that you don't need to worry about the protocol 最好使用//代替http ot https,这样您就不必担心协议了

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

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