JavaScript - Changing HTTP IMG Tags to HTTPS
Making note of this for myself. Enjoy, though, if you need it.
<SCRIPT LANGUAGE="JavaScript">
<!--
window.onload = function () {
var all = document.getElementsByTagName('*');
var images = [];
for(var a=0;a<all.length;++a){
if(all[a].tagName == 'IMG')
images.push(all[a]);
}
for(var i=0;i<images.length;++i) {
var myNewLink = images[i].src
if (myNewLink.substring(0,8)!="https://") {
myNewLink = "" + myNewLink;
myNewLink = myNewLink.substring(7,myNewLink.length);
myNewLink = "https://" + myNewLink;
images[i].src = myNewLink;
}
}
}
//-->
</SCRIPT>
0 Comments:
Posta un commento
<< Home