Chrome DevTools Extract all URLs JS Snippet

Sitebee

Technical SEO
Staff member
Here is a handy JS snippet to extract all URLs within a webpage using the Console within Chrome DevTools.

Code:
var urls = document.getElementsByTagName('a');
for (url in urls) {
    console.log ( urls[url].href );
}
The output will resemble the below:
js-snippet-devtools.PNG


I find this method useful for data extraction. Pulling menu links, hreflang alt URLs, etc. Save it as a bookmarklet to save time pasting in the snippet over and over.