I am working on developing chrome extensions and am relatively new to this field. The project I am currently working on requires my extension to scan all the "webpages" present on the current "website" (that is the website that is currently open in the active tab of the browser). I need to get and print a list of all outbound links from the website (and not just the currently open webpage).
Progress so far: Using the chrome tabs API I have so far managed to get a list of all the outbound links from the currently active webpage. I fetch the URL and then using the query functions and a small script that makes use of document.links, I have been able to do this successfully for a single page.
Problem: I need to convert this into an iterative solution and be able to scan all the links from the current page, hit these links one-by-one and the repeat the process for each of the links and finally add the newly found links from them to the existing set of lists.
I understand this is not a trivial problem and basically need some guidance for the approach I should use. I haven't been able to hit the links discreetly without opening them in a new tab. I need a way to do this. It would be great if someone can guide me through this. Thanks!!