Skip to content

Instantly share code, notes, and snippets.

@henningpohl
Created April 8, 2013 16:57
Show Gist options
  • Save henningpohl/5338428 to your computer and use it in GitHub Desktop.
Save henningpohl/5338428 to your computer and use it in GitHub Desktop.
Bookmarklet to crawl a page for iframes, embeds and links and render those as easy to access list.
(function(){
// http://coding.smashingmagazine.com/2010/05/23/make-your-own-bookmarklets-with-jquery/
// http://subsimple.com/bookmarklets/jsbuilder.htm
if(window.jQuery === undefined) {
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js";
script.onload = script.onreadystatechange = function() {
bookmarklet();
};
document.getElementsByTagName("head")[0].appendChild(script);
} else {
bookmarklet();
}
function bookmarklet() {
var newContent = $("<div></div>");
newContent.append('<h2>iframes</h2>');
$('iframe').each(function(i, e) {
newContent.append('<a href="' + e.src + '">' + e.src + '</a><br/>');
});
newContent.append('<h2>embeds</h2>');
$('embed').each(function(i, e) {
newContent.append('<a href="' + e.src + '">' + e.src + '</a><br/>');
});
newContent.append('<h2>links</h2>');
$('a').each(function(i, e) {
if(e.href.indexOf('javascript') == -1) {
newContent.append('<a href="' + e.href + '">' + e.href + '</a><br/>');
}
});
$('body').empty();
$('body').append(newContent);
}
})();
javascript:(function(){if(window.jQuery===undefined){var script=document.createElement("script");script.src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js";script.onload=script.onreadystatechange=function(){bookmarklet();};document.getElementsByTagName("head")[0].appendChild(script);}else{bookmarklet();}function bookmarklet(){var newContent=$("<div></div>");newContent.append('<h2>iframes</h2>');$('iframe').each(function(i,e){newContent.append('<a href="'+e.src+'">'+e.src+'</a><br/>');});newContent.append('<h2>embeds</h2>');$('embed').each(function(i,e){newContent.append('<a href="'+e.src+'">'+e.src+'</a><br/>');});newContent.append('<h2>links</h2>');$('a').each(function(i,e){if(e.href.indexOf('javascript')==-1){newContent.append('<a href="'+e.href+'">'+e.href+'</a><br/>');}});$('body').empty();$('body').append(newContent);}})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment