I’m making a Chrome extension and am wanting to load a page in the background and grab images from it. I know that I could do this using jQuery’s $.get() function followed by several indexOf() statements nested within a loop, something like:
$.get("http://...",
function(response) {
a=response.indexOf("<IMG ", a)+1;
while (a>0)
{
...
but I’m wondering if there’s an easier way, maybe loading the page in an invisible iframe with the background script and looping through all the IMG objects in it? I’ve never done that before so any pointers would be welcome.
responseis probably a jQuery object (assuming you’re using jQuery), so you can treat it as one: