Javascript无法在https中运行 [英] Javascript is not working in https

查看:98
本文介绍了Javascript无法在https中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将https添加到我的网站,显然我网站上唯一的脚本已停止工作。我不认为这是剧本的问题,但在这里是:

I have just added https to my site and apparently the only script I have in my site has stopped working. I don't think it is a problem of the script but here it is:

function cambiarPestanna(pestannas,pestanna) {

    pestanna = document.getElementById(pestanna.id);
    listaPestannas = document.getElementById(pestannas.id);

    cpestanna = document.getElementById('c'+pestanna.id);
    listacPestannas = document.getElementById('contenido'+pestannas.id);

    i=0;
    while (typeof listacPestannas.getElementsByTagName('div')[i] != 'undefined'){
        $(document).ready(function(){
            $(listacPestannas.getElementsByTagName('div')[i]).css('display','none');
            $(listaPestannas.getElementsByTagName('li')[i]).css('background','');
            $(listaPestannas.getElementsByTagName('li')[i]).css('padding-bottom','');
        });
        i += 1;
    }

    $(document).ready(function(){
        $(cpestanna).css('display','');
        $(pestanna).css('background','white');
        $(pestanna).css('padding-bottom','2px'); 
    });

}

有谁知道这个问题的任何解决方案?

Does anyone know any solution to this problem?

感谢您对此事的考虑。

推荐答案

添加您的jQuery文件像这样,没有明确提及协议

Add your jQuery file like this, without mentioning the protocol explicitely

<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

从<$ c删除 http:部分$ c> src 表示你不想加载你在 src 中提到的固定协议的外部文件/资源​​,而不是你想要的使用与要求资源相同的协议加载外部资源。

removing http: part from src means you don't want to load external files/resources with fixed protocol that you are mentioning in the src, rather you want to load the external resources with the same protocol the demanding resource is residing.

这篇关于Javascript无法在https中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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