views:

136

answers:

1

Here's what I need to do. I'm using Google Chrome. I have page that auto-reloads every 5 seconds using a script:

javascript: timeout=prompt("Set timeout [s]"); 
current=location.href; 
if(timeout>0) 
    setTimeout('reload()',1000*timeout); 
else 
    location.replace(current); 

function reload()
{ 
    setTimeout('reload()',1000*timeout); 
    fr4me='<frameset cols=\'*\'>\n<frame src=\''+current+'\'/>'; fr4me+='</frameset>';     
    with(document){write(fr4me);void(close())}; 
}

I found that script by Googling.

The reason why the page auto-reloads every 5 seconds is I'm waiting for a specific link or url to appear in the page. It appears at random times. Once I see the link I'm waiting for, I immediately click the link. That's fine.

But I want more. What I want is the page will auto-reload and I want it to auto-detect the the link I'm waiting for. Once the script finds the link I'm waiting for, it automatically loads that link on a new tab or page.

For example, I'm auto-reloading www.example.com. I'm waiting for a specific url "BUY NOW". When the page auto-reloads, it checks if there's a url "BUY NOW". If it sees one, it should automatically open that link.

Thanks.

A: 

For inspiration, check out what I have done it in my Chrome Extension "Auto-Reload". The code is here.

You should create yourself an extension (from what I understand of your question, that's what you are implying). Once the page reloads, you can use jQuery (for example) to scrap the page for your link.

jldupont