I have just added HTTPS to my site and apparently the only script I have on my site has stopped working. I don’t think it is a problem of the script, but here it is:
JavaScript
x
26
26
1
function cambiarPestanna(pestannas, pestanna) {
2
3
pestanna = document.getElementById(pestanna.id);
4
listaPestannas = document.getElementById(pestannas.id);
5
6
cpestanna = document.getElementById('c' + pestanna.id);
7
listacPestannas = document.getElementById('contenido' + pestannas.id);
8
9
i = 0;
10
while (typeof listacPestannas.getElementsByTagName('div')[i] != 'undefined') {
11
$(document).ready(function() {
12
$(listacPestannas.getElementsByTagName('div')[i]).css('display', 'none');
13
$(listaPestannas.getElementsByTagName('li')[i]).css('background', '');
14
$(listaPestannas.getElementsByTagName('li')[i]).css('padding-bottom', '');
15
});
16
i += 1;
17
}
18
19
$(document).ready(function() {
20
$(cpestanna).css('display', '');
21
$(pestanna).css('background', 'white');
22
$(pestanna).css('padding-bottom', '2px');
23
});
24
25
}
26
What is the solution to this problem?
Advertisement
Answer
Add your jQuery file like this, without mentioning the protocol explicitly:
JavaScript
1
2
1
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
2
Removing the http:
part from src
means you don’t want to load external files/resources with a 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 in.