Skip to content

Instantly share code, notes, and snippets.

@dbalatero
Created August 30, 2016 01:02
Show Gist options
  • Save dbalatero/38e3949b1894173791bc32946c75bea8 to your computer and use it in GitHub Desktop.
Save dbalatero/38e3949b1894173791bc32946c75bea8 to your computer and use it in GitHub Desktop.
A fix for Neil's site to make sure any bad embeds get fixed
<script src="https://code.jquery.com/jquery-3.1.0.slim.min.js" integrity="sha256-cRpWjoSOw5KcyIOaZNo4i6fZ9tKPhYYb6i5T9RSVJG8=" crossorigin="anonymous"></script>
<script type="text/javascript">
// Fix for archive.org embed links that have erroneous http:// urls instead
// of https://
$(function() {
$("iframe").each(function(index, iframe) {
var $iframe = $(iframe);
var src = $iframe.attr('src');
if (src.indexOf("http://") >= 0) {
$iframe.attr('src', src.replace(/^http:/, "https:"));
}
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment