Use `document.createNodeIterator` to find all comments nodes inside <html>. For outside of <html>, see below: Find & Delete Comment Nodes Above/Below <html> Find & Delete Comment Nodes Above/Below <html>(Compacted)