diff --git a/include/functions2.php b/include/functions2.php
index 29594076c1c6baaac8fc87560a41652863b269c8..31ca98035e953b87fb940a733d4dd68a42c94200 100644
--- a/include/functions2.php
+++ b/include/functions2.php
@@ -911,8 +911,13 @@
 		foreach ($entries as $entry) {
 			if (!iframe_whitelisted($entry)) {
 				$entry->setAttribute('sandbox', 'allow-scripts');
+			} else {
+				if ($_SERVER['HTTPS'] == "on") {
+					$entry->setAttribute("src",
+						str_replace("http://", "https://",
+							$entry->getAttribute("src")));
+				}
 			}
-
 		}
 
 		$allowed_elements = array('a', 'address', 'audio', 'article', 'aside',