Hi all - I would like to get all the URLs available on a web page similar to the Chrome console function that prints all the URLs in the console.
var urls = document.getElementsByTagName('a');
for (url in urls) {
console.log ( urls[url].href );}
Is the 'Run JavaScript Function on Web Page' the right function to use? If yes, how can I modify the code above to render the URLs? I have tried the following, but it only returns [object Object] as the result.
var urls = document.getElementsByTagName('a');
var urlList = [];
for (var i = 0; i < urls.length; i++) {
urlList.push(urls[i].href);}
return urlList;
}
Any pointers would be very much appreciated! Thanks