Skip to content

Instantly share code, notes, and snippets.

@hughrawlinson
Last active December 20, 2015 05:28
Show Gist options
  • Save hughrawlinson/6078055 to your computer and use it in GitHub Desktop.
Save hughrawlinson/6078055 to your computer and use it in GitHub Desktop.
A short script to log html comments on a webpage, for use in a bookmarklet.
var content = document.body.innerHTML;;
var comments = content.match(/<!--.*?-->/g);
if(comments!=null|comments!=undefined){
for (var x = 0; x < comments.length;x++){
console.log(comments[x]);
}
}
else{
console.log('No Comments');
}
var c=document.body.innerHTML.content.match(/<!--.*?-->/g);if(c!=null|comments!=undefined){for (var x = 0; x < c.length;x++){console.log(c[x]);}}else{console.log('No Comments');}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment