JSFiddle - React, Tailwind, and code Playground
by Vicen
HTML
<a href="http://googles.es/">El enlace y el iframe estan en http y pasan a https por javascript.</a>
<iframe src="http://forobeta.com"></iframe>
JavaScript
if (document.location.protocol === 'https:') {
$('iframe').each(function() {
var src = $(this).attr('src');
if (src.indexOf('http:') > -1) {
src = src.replace('http:', 'https:');
$(this).attr('src', src);
}
});
$('a').each(function() {
var href = $(this).attr('href');
if (href.indexOf('http:') > -1) {
href = href.replace('http:', 'https:');
$(this).attr('href', href);
}
});
}