Chrome DevTools Extract all URLs JS Snippet


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

var urls = document.getElementsByTagName('a');
for (url in urls) {
    console.log ( urls[url].href );
The output will resemble the below:

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.