Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dasginganinja
Created September 28, 2017 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dasginganinja/4594812390e2f281f89e573b1b29ca9e to your computer and use it in GitHub Desktop.
Save dasginganinja/4594812390e2f281f89e573b1b29ca9e to your computer and use it in GitHub Desktop.
Find mixed mode issues in content. The src attribute matches scripts, images, iframes. The link href attribute is used for css.
jQuery(document).ready(function() {
var $srcitems = jQuery("[src^='http://']");
var $hrefitems = jQuery("link[href^='http://']");
var totalitems = $srcitems.length + $hrefitems.length;
if (totalitems > 0) {
alert('Found ' + totalitems + ' items that will trigger mixed mode. Check the console for these items.');
for (var i = 0, len = $srcitems.length; i < len; i++) {
console.log($srcitems[i]);
}
for (var i = 0, len = $hrefitems.length; i < len; i++) {
console.log($hrefitems[i]);
}
} else {
alert('No mixed-mode content warnings currently on this page.');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment